PUDDOR'S PROFILE
aren't you tired of being nice? don't you just want to go apeshit?
there's words for people who use AI instead of hiring artists and I'm not allowed to use them here, but i hope they know i'll see them in the northern territory
there's words for people who use AI instead of hiring artists and I'm not allowed to use them here, but i hope they know i'll see them in the northern territory
#============================================================================== # DAMAGE ALGORITHMS AND CTB LOGIC #============================================================================== class Game_Battler attr_accessor :next_action_time attr_accessor :last_agi attr_accessor :next_action attr_accessor :action_delay attr_accessor :rest_delay attr_accessor :next_delay attr_accessor :delay_estimation # used by update_actions_order attr_accessor :last_queued_action_time attr_accessor :no_of_queued_actions attr_accessor :currently_evaluated_action_time attr_accessor :state_shown attr_accessor :regular_turn_ended attr_accessor :sp_damage_pop attr_accessor :sprite attr_accessor :targeted alias initialize_CTB initialize def initialize initialize_CTB @next_action_time = 0 @last_agi = 0 @rest_delay = 0 @next_delay = 0 @last_queued_action_time = 0 @currently_evaluated_action_time = 0 @state_shown=0 @no_of_queued_actions=0 @sp_damage_pop=false @sprite=nil @targeted=false end #-------------------------------------------------------------------------- # * Applying Normal Attack Effects # attacker : battler #-------------------------------------------------------------------------- def attack_effect(attacker) p_debug=false # Clear critical flag self.critical = false # First hit detection hit_result = (rand(100) < attacker.hit) # If hit occurs if hit_result == true # Calculate basic damage #power = attacker.atk * attacker.str power = attacker.atk * attacker.atk m1 = (self.pdef-attacker.atk)/Float(attacker.atk+1) m2 = 1/(Math.exp(m1*0.7)) # riduzione da protezione #red = [self.pdef*self.pdef, 0.5*power].min print("attacker.atk: ",attacker.atk, " potenziale d'attacco---> ",power, " defender.pdef: ",self.pdef, " riduzione da protezione---> ",m2, " nuovo potenziale---> ",power*m2) if p_debug power *= m2 multiplier1 = (self.str-attacker.str)/Float(attacker.str+1) multiplier2 = 1/(Math.exp(multiplier1*0.7)) multiplier2 = [multiplier2,0.01].max multiplier2 = [multiplier2,5.0].min power *= multiplier2 power_hp=(power>0)?(Integer(Math.sqrt(power))):(-Integer(Math.sqrt(-power))) print("attacker.str: ",attacker.str, " defender.str: ",self.str, " riduzione da rapporto forze: ",multiplier2, " potenziale finale---> ",power, " potenziale finale in hp---> ",power_hp) if p_debug self.damage = power_hp # Element correction self.damage *= elements_correct(attacker.element_set) self.damage /= 100 # If damage value is strictly positive if self.damage > 0 # Critical correction if rand(100) < 4 * attacker.dex / self.agi self.damage *= 2 self.critical = true end # Guard correction if self.guarding? #print("guarding") self.damage /= 2 end end # Dispersion if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # Second hit detection eva = 8 * self.agi / attacker.dex + self.eva hit = self.damage < 0 ? 100 : 100 - eva hit = self.cant_evade? ? 100 : hit hit_result = (rand(100) < hit) end # If hit occurs if hit_result == true # State Removed by Shock remove_states_shock # Substract damage from HP self.hp -= self.damage # State change @state_changed = false states_plus(attacker.plus_state_set) states_minus(attacker.minus_state_set) # When missing else # Set damage to "Miss" self.damage = "Miss" # Clear critical flag self.critical = false end if self.hp=0 if self.actor? == false $game_variables[50] +=1 end end # End Method return true end #-------------------------------------------------------------------------- # * Apply Skill Effects # user : the one using skills (battler) # skill : skill #-------------------------------------------------------------------------- def skill_effect(user, skill) p_debug=false # Clear critical flag self.critical = false # If skill scope is for ally with 1 or more HP, and your own HP = 0, # or skill scope is for ally with 0, and your own HP = 1 or more if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1) # End Method return false end #Support for flying enemies if FLYING_ENEMIES.include?(self.id) and MNK_MOVING_SKILL.include?(skill.id) return false end # Clear effective flag effective = false # Set effective flag if common ID is effective effective |= skill.common_event_id > 0 # First hit detection hit = skill.hit if skill.atk_f > 0 hit *= user.hit / 100 end hit_result = (rand(100) < hit) # Set effective flag if skill is uncertain effective |= hit < 100 ################### # Reflect support # ################### if self.state?($reflect_state_id) and !skill.element_set.include?($game_temp.cannot_reflect_element_id) hit_result = false end # If hit occurs if hit_result == true # Calculate power ######################################################################## # TECHNIQUES ######################################################################## if skill.is_technique() power = skill.power * user.atk * user.atk / 100.0 m1 = (self.pdef-user.atk)/Float(user.atk+1) m2 = 1/(Math.exp(m1*0.7)) print("TECNICA skill.power:",skill.power, " user.atk:",user.atk, " potenziale d'attacco---> ",power, " defender.pdef: ",self.pdef, " riduzione da protezione: ",m2, " nuovo potenziale---> ",power*m2) if p_debug power *= m2 multiplier1 = (self.dex-user.dex)/Float(user.dex+1) multiplier2 = 1/(Math.exp(multiplier1*0.7)) multiplier2 = [multiplier2,0.01].max multiplier2 = [multiplier2,5.0].min power *= multiplier2 power_hp=(power>0)?(Integer(Math.sqrt(power))):(-Integer(Math.sqrt(-power))) print("user.dex: ",user.dex, " defender.dex: ",self.dex, " riduzione da rapporto tecniche: ",multiplier2, " potenziale finale---> ",power, " potenziale finale in hp---> ",power_hp) if p_debug rate = 20 rate += (user.str * skill.str_f / 100) rate += (user.dex * skill.dex_f / 100) rate += (user.agi * skill.agi_f / 100) # rate += (user.int * skill.int_f / 100) # Calculate basic damage self.damage = power_hp * rate / 20 #print("danno tenendo conto dei fattori str_f etc:",self.damage) else ######################################################################## # ARTS ######################################################################## # potenziale d'attacco power = skill.power * user.int m1 = (self.mdef-skill.power)/Float(skill.power+1) m2 = 1/(Math.exp(m1*0.7)) # riduzione da protezione #red = [self.mdef*self.mdef, 0.3*power].min print("MAGIA skill.power:",skill.power, " user.int:",user.int, " potenziale d'attacco---> ",power, " defender.mdef: ",self.mdef, " riduzione da protezione: ",m2, " nuovo potenziale---> ",power*m2) if p_debug power *= m2 if(power>0) multiplier1 = (self.int-user.int)/Float(user.int+1) else multiplier1 = 0 end multiplier2 = 1/(Math.exp(multiplier1*1.0)) multiplier2 = [multiplier2,0.01].max multiplier2 = [multiplier2,5.0].min power *= multiplier2 power_hp=(power>0)?(Integer(Math.sqrt(power))):(-Integer(Math.sqrt(-power))) print("user.int: ",user.int, " defender.int: ",self.int, " riduzione da rapporto menti: ",multiplier2, " potenziale finale---> ",power, " potenziale finale in hp---> ",power_hp) if p_debug #power = skill.power + user.atk * skill.atk_f / 100 #if power > 0 # power -= self.pdef * skill.pdef_f / 200 # power -= self.mdef * skill.mdef_f / 200 # power = [power, 0].max #end # Calculate rate rate = 20 rate += (user.str * skill.str_f / 100) rate += (user.dex * skill.dex_f / 100) rate += (user.agi * skill.agi_f / 100) # rate += (user.int * skill.int_f / 100) # Calculate basic damage self.damage = power_hp * rate / 20 #print("danno tenendo conto dei fattori str_f etc:",self.damage) end # ARTS # Element correction self.damage *= elements_correct(skill.element_set) self.damage /= 100 # If damage value is strictly positive if self.damage > 0 # Guard correction if self.guarding? self.damage /= 2 end end # start of changes if $game_temp.selecting_all_enemies # Single/All correction self.damage /= 2 end # end of changes # Dispersion if skill.variance > 0 and self.damage.abs > 0 amp = [self.damage.abs * skill.variance / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # Second hit detection eva = 8 * self.agi / user.dex + self.eva hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100 hit = self.cant_evade? ? 100 : hit hit_result = (rand(100) < hit) # Set effective flag if skill is uncertain effective |= hit < 100 end # If hit occurs if hit_result == true # If physical attack has power other than 0 if skill.power != 0 and skill.atk_f > 0 # State Removed by Shock remove_states_shock # Set to effective flag effective = true end # Support for Aspire if skill.id==$aspire_skill_id # Substract damage from SP self.damage = [self.damage, self.sp].min last_sp = self.sp self.sp -= self.damage effective |= self.sp != last_sp user.sp+=[self.damage,last_sp].min user.damage= -[self.damage,last_sp].min user.sp_damage_pop=true self.sp_damage_pop=true # Support for steal elsif skill.id == $steal_skill_id and ENEMY_OBJECTS[self.id] != nil if rand(100)*user.agi - rand(100)*self.agi > 0 $game_temp.stolen_item_id = (user.state?($thievery_state_id))? ENEMY_OBJECTS[self.id][1]:ENEMY_OBJECTS[self.id][0] if $game_temp.stolen_item_id == nil $game_temp.stolen_item_id = ENEMY_OBJECTS[self.id][0] end $game_party.gain_item($game_temp.stolen_item_id,1) effective = true self.damage = "" else effective = false self.damage= "Miss" end else # Support for Demi if skill.id==$demi_skill_id self.damage = Integer(0.5 * self.hp) end # Substract damage from HP last_hp = self.hp self.hp -= self.damage effective |= self.hp != last_hp end # State change @state_changed = false effective |= states_plus(skill.plus_state_set) effective |= states_minus(skill.minus_state_set) # skip damage string contruction for Steal if skill.id != $steal_skill_id # If power is 0 if skill.power == 0 # Set damage to an empty string self.damage = "" # If state is unchanged unless @state_changed # Set damage to "Miss" self.damage = "Miss" end end end # If miss occurs else # Set damage to "Miss" self.damage = "Miss" ################### # reflect support # ################### if self.state?($reflect_state_id) and !skill.element_set.include?($game_temp.cannot_reflect_element_id) self.damage = "" end end # Support for Drain if skill.id==$drain_skill_id user.hp+=[self.damage, last_hp].min user.damage= -[self.damage, last_hp].min end # If not in battle unless $game_temp.in_battle # Set damage to nil self.damage = nil end if self.hp=0 if self.actor? == false $game_variables[50] +=1 end end # End Method return effective end #============================================================================== # CTB by Charlie #============================================================================== #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def enqueued_action() #print("enqueued_action") @last_queued_action_time = @currently_evaluated_action_time @no_of_queued_actions+=1 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def reset_order_data #p "reset_order_data" @last_queued_action_time = 0 @currently_evaluated_action_time = 0 @no_of_queued_actions = 0 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_order_data #print("update_order_data") if(@no_of_queued_actions == 0) @currently_evaluated_action_time = @next_action_time end if(@no_of_queued_actions == 1) @currently_evaluated_action_time = @last_queued_action_time + @next_delay end if(@no_of_queued_actions > 1) @currently_evaluated_action_time = @last_queued_action_time + @delay_estimation end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # executed at the beginning of the battle def battle_data_reset @next_action = nil if state?($priority_state_id) @next_action_time=0 else @next_action_time = ATTACK_DELAY*10000/agi*(rand(100)/100.0) end @last_agi = agi update_delays() reset_order_data() @action_delay=0 if self.is_a?(Game_Actor) refresh_commands end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def randomize_next_action_time @next_action_time = $game_temp.battle_time + ATTACK_DELAY*10000/agi*(rand(100)/100.0) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_next_action_time #if agi!=@last_agi # p @battler_name+"'s agi changed from "+@last_agi.to_s+" to "+agi.to_s #end temp = (@next_action_time-$game_temp.battle_time)*@last_agi # p @battler_name+" "+@last_agi.to_s @next_action_time = $game_temp.battle_time + temp/agi @last_agi=agi end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def action_executed(b_time) #print("action executed") @next_action_time = b_time + @action_delay + @rest_delay @next_action = nil end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def action_decided(b_time, action) # print("action decided") case action.kind when 0 # physical action if action.basic == 0 # attack @action_delay = ATTACK_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) else # defend @action_delay = DEFEND_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) end when 1 # skill @action_delay = SKILL_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) when 2 # item @action_delay = ITEM_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) when -1 # skip @action_delay = SKIP_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) when -2 # escape @action_delay = ESCAPE_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) end @rest_delay = REST_DELAY*10000/agi*(1+DELAY_VARIABILITY*(rand(100)-50)/50.0) @next_delay = @action_delay + @rest_delay @next_action = action end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def action_selected(b_time, action) # print("action selected") case action.kind when 0 # physical action if action.basic == 0 # attack @action_delay = ATTACK_DELAY*10000/agi elsif action.basic == 1 # defend @action_delay = DEFEND_DELAY*10000/agi else # default (attack) @action_delay = ATTACK_DELAY*10000/agi end when 1 # skill @action_delay = SKILL_DELAY*10000/agi when 2 # item @action_delay = ITEM_DELAY*10000/agi when -1 # skip @action_delay = SKIP_DELAY*10000/agi when -2 # escape @action_delay = ESCAPE_DELAY*10000/agi end # reset the rest_delay because action_decided changes it with some variability @rest_delay = REST_DELAY*10000/agi @next_delay = @action_delay + @rest_delay end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_delays update_next_action_time #print("update_delays") @rest_delay = REST_DELAY*10000/agi # estimation is based on avg attack delay @delay_estimation = @rest_delay + ATTACK_DELAY*10000/agi # next delay is used as the first delay following the active battler's action # by initilaizing it with @delay_estimation it reflects the fact that the # default selected action is "Attack" @next_delay=@delay_estimation end #============================================================================== # RIGENE SUPPORT #============================================================================== def rigene_effect self.damage = -self.maxhp / 15 if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end self.hp -= self.damage end #============================================================================== # SUPPORT FOR FORCED BATTLE ACTIONS #============================================================================== def current_action=(current_action) @current_action = current_action end #============================================================================== # SUPPORT FOR CYCLING STATE ANIMATION #============================================================================== #-------------------------------------------------------------------------- # * Get State Animation ID #-------------------------------------------------------------------------- def state_animation_id # If no states are added if @states.size == 0 return 0 end # Return 0 if dead if @states.include?(0) return 0 end # Return state animation ID return $data_states[@states[(@state_shown-1)%@states.size()]].animation_id end #-------------------------------------------------------------------------- # * Calculating Element Correction # element_set : element #-------------------------------------------------------------------------- ELEMENTS_TO_IGNORE=[32,33,34,35,36,37,38,39,40,41,43,44,46,47,48,49,50] def elements_correct(element_set) # If not an element if element_set - ELEMENTS_TO_IGNORE == [] # Return 100 return 100 end # Return the weakest object among the elements given # * "element_rate" method is defined by Game_Actor and Game_Enemy classes, # which inherit from this class. weakest = 200 for i in element_set - ELEMENTS_TO_IGNORE weakest = [weakest, self.element_rate(i)].min end return weakest end end