Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Emoji
- module To_Battle!
- Battle_Grid ={
- # set grid cell size
- :cell_height => 32,
- :cell_width => 32,
- # set grid size {duplicate by 2 for each side so for example
- # for make 10 cell use 5}
- :range_x => 5,
- :range_y => 2,
- #Battle Range type {set by skill,item}
- #linear_type {go in front of the user vertically or horizontaly}
- # it's use mostly for regular_attack
- # you can edit it via notetag but
- # you still need a default base
- # x_range,y_range, vertical or hori
- :linear_type => [2,0,false],
- #cross_type {do a vertical and horizontal range in same time}
- # serve for doing a small radius of damage around the target it's do a cross
- # lines style
- #x_range,y_range,widht,height
- :cross_type => [2,2,2,2],
- #square_type { do a square area around the target in the 8 direction}
- # will do a small square radius of damage around the target.
- #x_range, y_range
- :square_type =[3,3],
- # default actor and enemy move range {move in the 8 direction movement}
- # values works for x and y
- :default_actor_move_range = 3,
- :default_enemy_move_range = 3
- }
- end
- end
- class Game_Grid
- include Emoji::To_Battle!
- attr_accessor :cell_width
- attr_accessor :cell_height
- attr_accessor :range_x
- attr_accessor :range_y
- attr_accessor :x
- attr_accessor :y
- attr_accessor :real_x
- attr_accessor :real_y
- attr_accessor :range_type
- attr_accessor :linear_type
- attr_accessor :cross_type
- attr_accessor :square_type
- attr_accessor :move_flag
- attr_accessor :move_range
- attr_reader :last_pos #for cursor sake
- def initialize
- @cell_width = 0
- @cell_height = 0
- @range_x = 0
- @range_y = 0
- @x = 0
- @y = 0
- @real_x = 0
- @real_y = 0
- @range_type = nil
- @linear_type = [ ]
- @cross_type = [ ]
- @square_type = [ ]
- @move_flag = false
- @move_range = 0
- @last_pos = nil
- init_grid
- end
- def init_grid
- @cell_height = Battle_Grid[:cell_height]
- @cell_width = Battle_Grid[:cell_width]
- @range_x = Battle_Grid[:range_x]
- @range_y = Battle_Grid[:range_y]
- @grid_center = [Graphics.width /2, Graphics.height /2 ]
- set_type
- end
- def set_type
- set_linear_type
- set_cross_type
- set_square_type
- end
- def set_linear_type
- if @skill.note =~ /<battle_range : i,c>/
- @battle_range_x = i
- @battle_range_y = c
- @battle_range_x = Battle_Grid[:linear_type[0]]
- @battle_range_y = Battle_Grid[:linear_type[1]]
- @hori_verti = Battle_Grid[:linear_type[2]]
- @linear_type.push(@battle_range_x,@battle_range_y,@hori_verti)
- def out_of_grid_range?
- @x > @range_x || @y > @range_y
- end
- def max_grid_size
- return (@range_x + @range_y) * 2
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement