Advertisement
LiTTleDRAgo

[RGSS] Mr_Wiggles - XAS Difficulties

Mar 29th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 35.02 KB | None | 0 0
  1.          
  2.         #===============================================================================
  3.         #                        XAS Different Difficulties
  4.         #===============================================================================
  5.         # Created by Mr_Wiggles
  6.         # Version: 1.5
  7.         # Date: 4/09/2012
  8.         #===============================================================================
  9.         #
  10.         # Instructions:
  11.         #
  12.         # Place bellow XAS System, and if your using "XRXS - Damage Pop" be sure to
  13.         # place this bellow that as well.
  14.         #
  15.         #===============================================================================
  16.         #  You can use conditional braches for the Difficulties by useing:
  17.         #
  18.         #  $game_system.difficulty_name == "NAME"
  19.         #
  20.         #  in your conditional branch. The NAME is are the same as you specify in the
  21.         #  configuration below.
  22.         #
  23.         #    I.E. you want somthing to only show up on easy mode, you'd use a
  24.         #    Conditional Branch in an event useing the script command that would
  25.         #    say:
  26.         #              $game_system.difficulty_name == "Easy"
  27.         #
  28.         #
  29.         #  You can use the same method as above to check if a difficulty is
  30.         #  locked by using:
  31.         #
  32.         #              diff_locked?(name)
  33.         #
  34.         #
  35.         #  To unlock a difficulty, use an event command script call that says:
  36.         #
  37.         #              unlock_diff(name)
  38.         #
  39.         #===============================================================================
  40.          
  41.         #===============================================================================
  42.         # Use the following template to create difficulties in your game
  43.         # Note that all the "rates" are in %. Values over 100 will increase, values
  44.         # under 100 will decrease the given attribute. Of course you can add/remove
  45.         # any difficulties you want, be sure to separate them with commas.
  46.         #===============================================================================
  47.         # DIFFICULTIES = [
  48.         #  [ (1) , (2) , (3) , (4) , (5) ],
  49.         #  [ (1) , (2) , (3) , (4) , (5) ],
  50.         #  [ (1) , (2) , (3) , (4) , (5) ]
  51.         # ]
  52.         #
  53.         # 1) "NAME"            - This is what you want to call your diffuculty level
  54.         #
  55.         # 2) EXP_RATE          - This modifies the amount of experance the player gains
  56.         #
  57.         # 3) GOLD_RATE        - This modifies the amount of gold gained from Enemies
  58.         #
  59.         # 4) ACTOR_DAMAGE_RATE - This modifies the amount of damage the actor deals
  60.         #
  61.         # 5) ENEMY_DAMAGE_RATE - This Modifies the amount of damage the enemies deal
  62.         #
  63.         #-------------------------------------------------------------------------------
  64.          
  65.         DIFFICULTIES = [
  66.          ["Easy"    , 125, 125, 120,  50],
  67.          ["Normal"  , 100, 100, 100, 100],
  68.          ["Hard"    ,  75,  75,  80, 150],
  69.          ["God Like",  20,  20,  50, 210],
  70.          ["Give Up" ,  5,  5,  10, 300]
  71.         ]
  72.          
  73.         LOCKED = ["God Like", "Give Up"] # Names of the difficulties locked at start
  74.                                         # if you already playtested you will need to
  75.                                         # delete the Title.rxdata data file in your
  76.                                         # Game folder inorder to change the values.
  77.          
  78.         SCREEN_SHAKE      = false  # Screen shakes on Crittical hits
  79.         USEING_DAMAGE_POP = true  # Are you using XRXS - Damage Pop
  80.          
  81.         WINDOW_OPACITY    = 0
  82.         WINDOW_X          = 220    # X location of Difficulty window (center = 220)
  83.         WINDOW_Y          = 200    # Y location of Difficulty window (center = 200)
  84.          
  85.         CUSTOM = true # use this only if you have a custom game menu. Will prevent
  86.                       # the origional menu from popping back up.
  87.          
  88.          
  89.          
  90.         #===============================================================================
  91.         #                      *  END Congfig  *
  92.         #===============================================================================
  93.          
  94.         #==============================================================================
  95.         # Game_System
  96.         #==============================================================================
  97.         class Game_System
  98.           attr_reader :difficulty_name, :exp_rate, :gold_rate, :actor_rate, :enemy_rate
  99.          
  100.           def init_difficulty(name)
  101.             diffs = []
  102.             for dif in DIFFICULTIES
  103.               n = dif[0]
  104.               diffs.push(n) unless difficulty_locked?(name)
  105.             end
  106.             index = diffs.index(name)
  107.             @difficulty_name, @exp_rate, @gold_rate, @actor_rate, @enemy_rate =
  108.             DIFFICULTIES[index]
  109.           end
  110.          
  111.           def difficulty_locked?(name)
  112.             if @diffs_locked.nil?
  113.               if !FileTest.exist?("Title.rxdata")
  114.                 @diffs_locked = LOCKED
  115.                 file = File.open("Title.rxdata", "wb")
  116.                   Marshal.dump(@diffs_locked, file)
  117.                 file.close
  118.               else
  119.                 file = File.open("Title.rxdata", "r")
  120.                   @diffs_locked = Marshal.load(file)
  121.                 file.close
  122.               end
  123.             end
  124.             return @diffs_locked.include?(name)
  125.           end
  126.          
  127.           def unlock_difficulty(name)
  128.             @diffs_locked.delete(name)
  129.             file = File.open("Title.rxdata", "wb")
  130.               Marshal.dump(@diffs_locked, file)
  131.             file.close
  132.           end
  133.         end
  134.          
  135.         #===============================================================================
  136.         # Interperter
  137.         #===============================================================================
  138.         class Interpreter
  139.           def diff_locked?(name)
  140.             $game_system.difficulty_locked?(name)
  141.           end
  142.          
  143.           def unlock_diff(name)
  144.             $game_system.unlock_difficulty(name)
  145.           end
  146.         end
  147.          
  148.         #===============================================================================
  149.         # Game_Battler
  150.         #===============================================================================
  151.         class Game_Battler
  152.         #-------------------------------------------------------------------------------
  153.         #  Normal Attack
  154.         #-------------------------------------------------------------------------------
  155.         def attack_effect(attacker)
  156.           self.critical = false
  157.           hit_result = (rand(100) < attacker.hit)
  158.         if hit_result == true
  159.          
  160.           # Check if Invinvible State
  161.           if self.states.include?(XAS::INVINCIBLE_ID)
  162.               $game_system.se_play(XAS_ABS_SETUP::SHIELD_SE)
  163.               self.damage = $data_states[XASINVINCIBLE_ID].name
  164.             return  
  165.           end # end Invinvible Check
  166.          
  167.           # Check if Sleep State
  168.           if self.states.include?(XAS::SLEEP_ID)
  169.               self.xas_states_sleep_time = 0
  170.               self.xas_states_sleep = false
  171.               self.xas_states_sleep_ani = 0
  172.               self.remove_state(XAS::SLEEP_ID)
  173.           end # end Sleep State Check
  174.          
  175.         # Attack Calculations
  176.         atk = [attacker.atk - self.pdef / 2, 0].max
  177.         self.damage = atk * (20 + attacker.str) / 20
  178.         self.damage *= elements_correct(attacker.element_set)
  179.         self.damage /= 100
  180.          
  181.          # if Guarding
  182.          if self.damage > 0
  183.             if self.guarding?
  184.               self.damage /= 2
  185.             end
  186.          end # end Guard Check
  187.          
  188.         if self.damage.abs > 0
  189.           amp = [self.damage.abs * 15 / 100, 1].max
  190.           self.damage += rand(amp+1) + rand(amp+1) - amp
  191.         end
  192.          
  193.         eva = 8 * self.agi / attacker.dex + self.eva
  194.         hit = self.damage < 0 ? 100 : 100 - eva
  195.         hit = self.cant_evade? ? 100 : hit
  196.         hit_result = (rand(100) < hit)
  197.          
  198.         end # end if hit_result == true
  199.          
  200.         if hit_result == true
  201.          
  202.           # If attack is critical
  203.           if (rand(100) < 4 * attacker.dex / self.agi) or
  204.               attacker.states.include?(XAS::BERSERK_ID)
  205.               critical_damage = self.damage * XAS_SKILL::CRITICAL_DAMAGE_PERC / 100      
  206.               self.damage += critical_damage
  207.               self.critical = true
  208.            
  209.               # make screen shake
  210.               if SCREEN_SHAKE
  211.                 $game_screen.start_shake(5,10,20)
  212.               end # end Screen Shake
  213.              
  214.           end # end Critical Attack Equasion
  215.          
  216.         if XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true
  217.           actor = $game_party.actors[0]
  218.           armor_id = actor.armor1_id
  219.           armor_tool_id = XAS_SKILL::SHIELD_ID_TOOL[armor_id]
  220.           #------------------------------------------------------------
  221.           if self.is_a?(Game_Actor) and
  222.               $game_temp.shield_active == true and
  223.               $game_system.move_meter > XAS::DASH_ACTIVE_PERC and
  224.               self.damage > 0 and not
  225.               XAS_BA_ENEMY::IGNORE_HERO_SHIELD.include?(attacker.id) and
  226.               (armor_tool_id != nil or armor_tool_id == 0) and
  227.               $game_temp.defense_per > 0 and
  228.               $game_switches[XASCT_DISABLE_SWITCH] == false # if end line
  229.           #-----------------------------------------------------------
  230.           #          ^ that is a BIG if....
  231.           #-----------------------------------------------------------  
  232.               defence_p = self.damage * $game_temp.defense_per / 100
  233.               self.damage -= defence_p
  234.            
  235.               if XAS_ABS_SETUP::DEFENSE_COST_TYPE == 1
  236.                 damage_ct = 10 + rand(10)
  237.                 $game_system.move_meter -= damage_ct
  238.               end # end XAS_ABS_SETUP::DEFENSE_COST_TYPE == 1
  239.            
  240.           end # end the "BIG" if
  241.          
  242.         end # end XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true
  243.          
  244.         remove_states_shock
  245.          
  246.         # if the attacker is an Enemy
  247.         if attacker.is_a?(Game_Enemy)  
  248.           attack_hp_per    = XAS_BA_ENEMY::ATTACK_HP_PERC[attacker.id]
  249.           attack_maxhp_per  = XAS_BA_ENEMY::ATTACK_MAXHP_PERC[attacker.id]
  250.           attack_sp_per    = XAS_BA_ENEMY::ATTACK_SP_PERC[attacker.id]
  251.           attack_maxsp_per  = XAS_BA_ENEMY::ATTACK_MAXSP_PERC[attacker.id]
  252.           attack_add_states = XAS_BA_ENEMY::ATTACK_ADD_STATES[attacker.id]
  253.          
  254.             # if Special attack markers
  255.             if attack_hp_per != nil
  256.               self.damage = self.hp * attack_hp_per / 100
  257.             elsif attack_maxhp_per != nil
  258.               self.damage = self.maxhp * attack_maxhp_per / 100
  259.             elsif attack_sp_per != nil
  260.               self.damage = self.sp * attack_sp_per / 100
  261.             elsif attack_maxsp_per != nil
  262.               self.damage = self.maxhp * attack_maxsp_per / 100
  263.             end # end Special attack markers
  264.          
  265.           # if attack causes a state
  266.           if attack_add_states != nil
  267.             self.add_state(attack_add_states)
  268.           end # end States add
  269.          
  270.         end # end if attacker is an Enemy
  271.          
  272.         if attack_sp_per != nil or attack_maxsp_per != nil
  273.          
  274.          
  275.           if XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true
  276.               actor = $game_party.actors[0]
  277.               armor_id = actor.armor1_id
  278.               armor_tool_id = XAS_SKILL::SHIELD_ID_TOOL[armor_id]
  279.            
  280.               #------------------------------------------------------------
  281.               if self.is_a?(Game_Actor) and $game_temp.shield_active == true and
  282.                 $game_system.move_meter > XAS::DASH_ACTIVE_PERC and
  283.                 self.damage > 0 and not
  284.                 XAS_BA_ENEMY::IGNORE_HERO_SHIELD.include?(attacker.id) and
  285.                 (armor_tool_id != nil or armor_tool_id == 0)
  286.               #-----------------------------------------------------------
  287.               #          ^ that is a BIG if....
  288.               #-----------------------------------------------------------
  289.                 self.damage = self.damage * $game_temp.defense_per / 100
  290.               end # end "BIG" if
  291.          
  292.           end # end XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true
  293.          
  294.             # If damage is greater then Skill points?
  295.             if self.damage > self.sp
  296.               self.sp -= self.sp
  297.               self.damage = $data_system.words.sp + " " + self.sp.to_s    
  298.           else
  299.               self.sp -= self.damage
  300.               self.damage = $data_system.words.sp + " " + self.damage.to_s
  301.             end # end if Damage Higher then Skill Points
  302.          
  303.         else # for (if attack_sp_per != nil or attack_maxsp_per != nil)
  304.          
  305.           if self.states.include?(XAS::LIFE_ID) and
  306.               self.hp <= self.damage
  307.               self.damage = 0
  308.               self.hp = 1
  309.               self.xas_states_life_on = true
  310.               return
  311.           end
  312.         #--------------------------------------------------------------
  313.         # Damage Modifier
  314.         #--------------------------------------------------------------
  315.         # if Attacker is an Enemy
  316.          if attacker.is_a?(Game_Enemy)
  317.           self.damage = self.damage * $game_system.enemy_rate / 100
  318.         # if Attacker is the Player
  319.         # else
  320.         #  self.damage = self.damage * $game_system.actor_rate / 100
  321.          end
  322.         #--------------------------------------------------------------
  323.           self.hp -= self.damage
  324.         end
  325.          
  326.         @state_changed = false
  327.         states_plus(attacker.plus_state_set)
  328.         states_minus(attacker.minus_state_set)
  329.         else
  330.           self.damage = "Miss"
  331.           self.critical = false
  332.         end
  333.           return true
  334.         end
  335.          
  336.         #-------------------------------------------------------------------------------
  337.         #  Skill Attack For Player
  338.         #-------------------------------------------------------------------------------
  339.           def skill_effect(user, skill)
  340.             @actor = $game_party.actors[0]
  341.             self.critical = false
  342.             if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  343.               ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  344.               return false
  345.             end
  346.             effective = false
  347.             effective |= skill.common_event_id > 0
  348.             hit = skill.hit
  349.             if skill.atk_f > 0
  350.               hit *= user.hit / 100
  351.             end
  352.             hit_result = (rand(100) < hit)
  353.             effective |= hit < 100
  354.             if hit_result == true  
  355.             ignore_reflect = Database_Bullet::IGNORE_REFLECT[skill.id]    
  356.               if self.states.include?(XAS::INVINCIBLE_ID)
  357.                 $game_system.se_play(XAS_ABS_SETUP::SHIELD_SE)
  358.                 self.damage = $data_states[XASINVINCIBLE_ID].name
  359.               return
  360.               elsif self.states.include?(XAS::REFLECT_ID) and not
  361.                     ((self.is_a?(Game_Actor) and user.is_a?(Game_Actor)) or
  362.                     (self.is_a?(Game_Enemy) and user.is_a?(Game_Enemy))) and not
  363.               (XAS_SKILL::WEP_ID_TOOL.include?(skill.id) or
  364.                 XAS::ITEM_COST.include?(skill.id) or
  365.                 ignore_reflect == true)
  366.                     self.damage = ""
  367.               return
  368.               elsif XAS_SKILL::ONE_HP_DAMAGE.include?(skill.id)
  369.               self.damage = XAS_SKILL::ONE_HP_TEXT
  370.               self.hp = 1
  371.               if self.is_a?(Game_Enemy) and $mog_rgss_xas_enemy_hp != nil  
  372.                 $xas_enemy_name = $data_enemies[self.id].name
  373.                 $game_temp.xas_info_ref = 40 * MOG::ENEMY_INFO_FADE_TIME
  374.         #--------------------------------------------------------------
  375.         # Damage Modifier
  376.         #--------------------------------------------------------------
  377.         # if Attacker is the Player
  378.          unless self.is_a?(Game_Enemy)
  379.           self.damage = self.damage * $game_system.actor_rate / 100
  380.          end
  381.         #--------------------------------------------------------------
  382.                 $xas_enemy_hp = self.hp    
  383.                 $xas_enemy_maxhp = self.maxhp
  384.                 $xas_info_ref = true
  385.               end    
  386.               return
  387.               end
  388.               power = skill.power + user.atk * skill.atk_f / 100
  389.               if power > 0
  390.                 power -= self.pdef * skill.pdef_f / 200
  391.                 power -= self.mdef * skill.mdef_f / 200
  392.                 power = [power, 0].max
  393.               end
  394.               rate = 20
  395.               rate += (user.str * skill.str_f / 100)
  396.               rate += (user.dex * skill.dex_f / 100)
  397.               rate += (user.agi * skill.agi_f / 100)
  398.               rate += (user.int * skill.int_f / 100)
  399.               self.damage = power * rate / 20
  400.               self.damage *= elements_correct(skill.element_set)
  401.               self.damage /= 100
  402.               critical_damage = self.damage * XAS_SKILL::CRITICAL_DAMAGE_PERC / 100
  403.               if self.damage > 0
  404.                 if self.states.include?(XAS::SLEEP_ID)
  405.                   self.xas_states_sleep_time = 0
  406.                   self.xas_states_sleep = false
  407.                   self.xas_states_sleep_ani = 0
  408.                   self.remove_state(XAS::SLEEP_ID)
  409.                 end  
  410.                 unless user.states.include?(XAS::BERSERK_ID)    
  411.                 if XAS_SKILL::SKILL_CRITICAL_ON == true
  412.          
  413.                         if rand(100) < 4 * user.dex / self.agi
  414.                           self.damage += critical_damage
  415.                           self.critical = true
  416.                         end      
  417.          
  418.                 else
  419.                 if XAS_SKILL::WEP_ID_TOOL.include?(skill.id) and
  420.                   user.is_a?(Game_Actor)
  421.                 if rand(100) < 4 * user.dex / self.agi
  422.                   self.damage += critical_damage
  423.                   self.critical = true
  424.                 end    
  425.                 end
  426.                 end  
  427.                 end  
  428.                 if self.guarding?
  429.                   self.damage /= 2
  430.                 end    
  431.               end
  432.               if skill.variance > 0 and self.damage.abs > 0
  433.                 amp = [self.damage.abs * skill.variance / 100, 1].max
  434.                 self.damage += rand(amp+1) + rand(amp+1) - amp
  435.               end
  436.               eva = 8 * self.agi / user.dex + self.eva
  437.               hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  438.               hit = self.cant_evade? ? 100 : hit
  439.               hit_result = (rand(100) < hit)
  440.               effective |= hit < 100
  441.               enemy = self
  442.             if self.is_a?(Game_Enemy) and self.steal == false and not
  443.                 XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id) and
  444.                 XAS_SKILL::STEAL_EFFECT.include?(skill.id)    
  445.                 treasures = []
  446.                 if rand(100) < enemy.treasure_prob
  447.                 if enemy.treasure_prob > 0      
  448.                   if enemy.item_id > 0
  449.                     treasures.push($data_items[enemy.item_id])
  450.                   end
  451.                   if enemy.weapon_id > 0
  452.                     treasures.push($data_weapons[enemy.weapon_id])
  453.                   end
  454.                   if enemy.armor_id > 0
  455.                     treasures.push($data_armors[enemy.armor_id])
  456.                   end
  457.             for item in treasures
  458.               case item
  459.               when RPG::Item
  460.                 $game_party.gain_item(item.id, 1)
  461.               when RPG::Weapon
  462.                 $game_party.gain_weapon(item.id, 1)
  463.               when RPG::Armor
  464.                 $game_party.gain_armor(item.id, 1)
  465.               end
  466.             end    
  467.          
  468.             if item != nil
  469.                     self.damage = XAS_SKILL::STEAL_TEXT + item.name.to_s
  470.                     $game_system.se_play(XAS_SKILL::STEAL_SE)
  471.             else
  472.                     self.damage = XAS_SKILL::STEAL_NOITEM_TEXT
  473.             end        
  474.                     self.damage_pop = true  
  475.                     self.steal = true
  476.                     end    
  477.                 return
  478.             else          
  479.                     self.damage = XAS_SKILL::STEAL_MISS_TEXT
  480.                     self.damage_pop = true      
  481.                     return
  482.             end
  483.               elsif self.is_a?(Game_Enemy) and self.steal == true and not
  484.                 XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id) and
  485.                 XAS_SKILL::STEAL_EFFECT.include?(skill.id)
  486.                     self.damage = XAS_SKILL::STEAL_NOITEM_TEXT
  487.                     self.damage_pop = true  
  488.                     self.steal = true
  489.               return    
  490.               end
  491.             end
  492.             if hit_result == true
  493.               if XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true and
  494.                 $game_switches[XASCT_DISABLE_SWITCH] == false
  495.               actor = $game_party.actors[0]
  496.               armor_id = actor.armor1_id
  497.               armor_tool_id = XAS_SKILL::SHIELD_ID_TOOL[armor_id]    
  498.               ignore_playershield = Database_Bullet::IGNORE_PLAYERSHIELD[skill.id]
  499.               if self.is_a?(Game_Actor) and $game_temp.shield_active == true and
  500.                 $game_system.move_meter > XAS::DASH_ACTIVE_PERC and
  501.                 self.damage > 0 and ignore_playershield == false and
  502.                 (armor_tool_id != nil or armor_tool_id == 0) and
  503.                 $game_temp.defense_per > 0
  504.                 defence_p = self.damage * $game_temp.defense_per / 100
  505.                 self.damage -= defence_p
  506.                 if XAS_ABS_SETUP::DEFENSE_COST_TYPE == 1
  507.                 $game_system.move_meter -= skill.sp_cost
  508.                 end
  509.                 end  
  510.               end
  511.               if user.states.include?(XAS::BERSERK_ID) and
  512.                 user.is_a?(Game_Actor) and
  513.                 XAS_SKILL::WEP_ID_TOOL.include?(skill.id)
  514.                 self.critical = true
  515.                 self.damage += critical_damage
  516.               end    
  517.               if skill.power != 0 and skill.atk_f > 0
  518.                 remove_states_shock
  519.                 effective = true
  520.               end
  521.               actor = $game_party.actors[0]
  522.               per_damage_maxhp = XAS_SKILL::PER_DAMAGE_HPMAX[skill.id]
  523.               per_damage_hp = XAS_SKILL::PER_DAMAGE_HP[skill.id]
  524.               per_damage_maxsp = XAS_SKILL::PER_DAMAGE_SPMAX[skill.id]
  525.               per_damage_sp = XAS_SKILL::PER_DAMAGE_SP[skill.id]  
  526.               fix_damage = XAS_SKILL::FIX_DAMAGE[skill.id]
  527.               level_damage = XAS_SKILL::LEVEL_DAMAGE[skill.id]
  528.               level_damage_plus = XAS_SKILL::LEVEL_DAMAGE_PLUS[skill.id]
  529.               per_damage_hp_self = XAS_SKILL::PER_DAMAGE_HP_SELF[skill.id]
  530.               per_damage_maxhp_self = XAS_SKILL::PER_DAMAGE_MAXHP_SELF[skill.id]
  531.               per_damage_sp_self = XAS_SKILL::PER_DAMAGE_SP_SELF[skill.id]
  532.               per_damage_maxsp_self = XAS_SKILL::PER_DAMAGE_MAXSP_SELF[skill.id]
  533.               per_gold_damage = XAS_SKILL::GOLD_DAM_PERC[skill.id]
  534.               if per_damage_maxhp != nil
  535.               self.damage = self.maxhp * per_damage_maxhp / 100
  536.               elsif per_damage_hp != nil
  537.               self.damage = self.hp * per_damage_hp / 100
  538.               elsif per_damage_maxhp_self != nil
  539.               self.damage = user.maxhp * per_damage_maxhp_self / 100
  540.               elsif per_damage_hp_self != nil
  541.               self.damage = user.hp * per_damage_hp_self / 100
  542.               elsif per_damage_maxsp_self != nil
  543.               self.damage = user.maxsp * per_damage_maxsp_self / 100
  544.               elsif per_damage_sp_self != nil
  545.               self.damage = user.sp * per_damage_sp_self / 100  
  546.               elsif fix_damage != nil
  547.               self.damage = fix_damage  
  548.               elsif level_damage != nil and user.is_a?(Game_Actor)
  549.               self.damage = actor.level * level_damage
  550.               elsif level_damage_plus != nil and user.is_a?(Game_Actor)
  551.               self.damage += (1 + self.damage * level_damage_plus / 100) * actor.level
  552.               elsif per_gold_damage != nil and user.is_a?(Game_Actor)
  553.               if per_gold_damage < $game_party.gold
  554.                 self.damage = per_gold_damage
  555.                 $game_party.lose_gold(per_gold_damage)
  556.               else
  557.                 self.damage = $game_party.gold
  558.                 $game_party.lose_gold($game_party.gold)    
  559.               end
  560.               elsif per_damage_maxsp != nil
  561.               self.damage = self.maxsp * per_damage_maxsp / 100
  562.               elsif per_damage_sp != nil
  563.               self.damage = self.sp * per_damage_sp / 100    
  564.               end
  565.               if self.damage > XAS_ABS_SETUP::DAMAGE_LIMIT
  566.                 self.damage = XAS_ABS_SETUP::DAMAGE_LIMIT
  567.               elsif self.damage < -XAS_ABS_SETUP::DAMAGE_LIMIT
  568.                 self.damage = -XAS_ABS_SETUP::DAMAGE_LIMIT
  569.               end
  570.               if self.critical == true
  571.                 unless XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id)
  572.                   if SCREEN_SHAKE
  573.                     $game_screen.start_shake(5,10,20)
  574.                   end
  575.                 end
  576.               end
  577.               last_hp = self.hp
  578.               drain_sp_effect = XAS_SKILL::DRAIN_SP_PERC[skill.id]
  579.               if self.states.include?(XAS::LIFE_ID) and
  580.                 self.hp <= self.damage
  581.                 self.damage = 0
  582.                 self.hp = 1
  583.                 self.xas_states_life_on = true
  584.                 return
  585.               end            
  586.               unless drain_sp_effect != nil
  587.               if per_damage_maxsp != nil or per_damage_sp != nil
  588.               if XAS_ABS_SETUP::DEFENSE_SYSTEM_ACTIVE == true
  589.               actor = $game_party.actors[0]
  590.               armor_id = actor.armor1_id
  591.               armor_tool_id = XAS_SKILL::SHIELD_ID_TOOL[armor_id]
  592.               ignore_playershield = Database_Bullet::IGNORE_PLAYERSHIELD[skill.id]  
  593.               if self.is_a?(Game_Actor) and $game_temp.shield_active == true and
  594.                 $game_system.move_meter > XAS::DASH_ACTIVE_PERC and
  595.                 self.damage > 0 and ignore_playershield == false and
  596.                 (armor_tool_id != nil or armor_tool_id == 0)
  597.                 self.damage = self.damage * $game_temp.defense_per / 100
  598.               end  
  599.               end
  600.               old_sp = self.sp
  601.               if self.damage > self.sp
  602.               real_damage = $data_system.words.sp + " " + self.sp.to_s
  603.               self.sp -= self.sp    
  604.               self.damage = real_damage    
  605.               else
  606.               real_damage = $data_system.words.sp + " " + self.damage.to_s
  607.               self.sp -= self.damage  
  608.               self.damage = real_damage
  609.               end
  610.             else
  611.         #--------------------------------------------------------------
  612.         # Damage Modifier
  613.         #--------------------------------------------------------------
  614.         # if Attacker is an Enemy
  615.         if self.is_a?(Game_Enemy)
  616.         #  self.damage = self.damage * $game_system.enemy_rate / 100
  617.         # if Attacker is the Player
  618.         #else
  619.           self.damage = self.damage * $game_system.actor_rate / 100
  620.         end
  621.         #--------------------------------------------------------------
  622.               self.hp -= self.damage
  623.            
  624.               end
  625.               end
  626.               effective |= self.hp != last_hp
  627.               @state_changed = false
  628.               unless XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id)
  629.               effective |= states_plus(skill.plus_state_set)
  630.               effective |= states_minus(skill.minus_state_set)
  631.               end
  632.               if skill.power == 0
  633.                 self.damage = ""
  634.               end
  635.             else
  636.               if self.is_a?(Game_Enemy) and self.steal == false and not
  637.                 XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id) and
  638.                 XAS_SKILL::STEAL_EFFECT.include?(skill.id)
  639.                     self.damage = XAS_SKILL::STEAL_MISS_TEXT
  640.                     self.damage_pop = true  
  641.               elsif self.is_a?(Game_Enemy) and self.steal == true and not
  642.                 XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id) and
  643.                 XAS_SKILL::STEAL_EFFECT.include?(skill.id)          
  644.                     self.damage = XAS_SKILL::STEAL_NOITEM_TEXT
  645.                     self.damage_pop = true                    
  646.               else  
  647.               self.damage = "Miss"
  648.               end  
  649.             end
  650.             unless $game_temp.in_battle
  651.               self.damage = nil
  652.             end
  653.             return effective
  654.           end
  655.          
  656.         end
  657.          
  658.         #==============================================================================
  659.         # Gold & Exp
  660.         #==============================================================================
  661.         class Game_Event < Game_Character
  662.           def enemy_defeat_process(enemy)
  663.             last_level = $game_player.battler.level
  664.         #--------------------------------------------------------------
  665.         # Difficulty Modifier
  666.         #--------------------------------------------------------------
  667.         $game_party.gain_exp(enemy.exp * $game_system.exp_rate / 100)
  668.         #--------------------------------------------------------------
  669.         $game_party.gain_gold(enemy.gold * $game_system.gold_rate / 100)
  670.         #--------------------------------------------------------------
  671.               if $mog_rgss_ap_parameter != nil
  672.               $game_party.gain_ap(enemy.ap)    
  673.               end  
  674.             if last_level < $game_player.battler.level
  675.               $game_system.se_play(XAS_BA::LEVEL_UP_SE)
  676.               $game_player.battler.damage = XAS_BA::LEVEL_UP_TEXT
  677.               $game_player.battler.damage_pop = true
  678.               $game_player.need_refresh = true
  679.               if XAS_BA::LEVELUP_RECOVER == true
  680.               actor = $game_party.actors[0]
  681.               actor.hp = actor.maxhp
  682.               actor.sp = actor.maxsp  
  683.               end
  684.             end
  685.             id = XAS_BA::DEFEAT_NUMBER_ID
  686.             $game_variables[id] += 1 if id != 0
  687.             switch_id = XAS_BA_ENEMY::DEFEAT_SWITCH_IDS[self.enemy_id]
  688.             jumpa(0,0,20) if XAS_BA_ENEMY::COLLAPSE_JUMP == true
  689.             if switch_id != nil
  690.               $game_switches[switch_id] = true
  691.               $game_map.refresh
  692.             end
  693.           end
  694.         end
  695.          
  696.         #==============================================================================
  697.         # Add selection to Scene_Title's  command_new_game
  698.         #==============================================================================
  699.          
  700.         class Scene_Title
  701.          
  702.           alias main_difficulties_later main
  703.           def main
  704.             main_difficulties_later
  705.             @difficulty_window.dispose if @difficulty_window != nil
  706.           end
  707.          
  708.           alias command_new_game_difficulties_later command_new_game
  709.           def command_new_game
  710.             $game_system.se_play($data_system.decision_se)
  711.             @difficulties = []
  712.             for diff in DIFFICULTIES
  713.               name = diff[0]
  714.               @difficulties.push(diff[0]) unless $game_system.difficulty_locked?(name)
  715.             end
  716.             @difficulty_window = Window_Command.new(@command_window.width, @difficulties)
  717.             @difficulty_window.x = WINDOW_X
  718.             @difficulty_window.y = WINDOW_Y -
  719.             (@difficulty_window.height - @command_window.height) / 2
  720.             @difficulty_window.back_opacity = WINDOW_OPACITY
  721.             @command_window.active = @command_window.visible = false
  722.             @difficulty_window.z = 99999
  723.           end
  724.          
  725.           alias :upd_dif_window :update
  726.           def update
  727.             if @difficulty_window.nil?
  728.               upd_dif_window; return
  729.             end
  730.             @difficulty_window.update
  731.             if Input.trigger?(Input::B)
  732.               $game_system.se_play($data_system.cancel_se)
  733.               @command_window.active, @command_window.visible = true, !CUSTOM
  734.               @difficulty_window.active, @difficulty_window.visible = false, false
  735.               @difficulty_window.dispose; @difficulty_window = nil
  736.            
  737.             elsif Input.trigger?(Input::C)
  738.               command_new_game_difficulties_later
  739.               $game_system.init_difficulty(@difficulties[@difficulty_window.index])
  740.               @difficulty_window.active, @difficulty_window.visible = false, false
  741.               @difficulty_window.dispose; @difficulty_window = nil
  742.               $scene = Scene_Map.new
  743.             end
  744.           end
  745.          
  746.         end
  747.          
  748.         #==============================================================================
  749.         # Update new Gold & Exp results  - for XRXS damage pop script
  750.         #==============================================================================
  751.         if USEING_DAMAGE_POP
  752.         module XRXS_ResultPop
  753.           def update
  754.             super
  755.             unless @xrxs_resultpop_done
  756.               if @battler == nil or not @battler.is_a?(Game_Enemy)
  757.                 @xrxs_resultpop_done = true
  758.                 return
  759.               end
  760.               if @_collapse_duration > 0 and @battler.gain_exp_act == true
  761.                 if @_collapse_duration == EXP
  762.                   if @battler.exp != 0
  763.                   #--------------------------------------------------------------
  764.                   # Difficulty Modifier
  765.                     exp_earn = @battler.exp
  766.                     exp_earn = exp_earn * $game_system.exp_rate / 100
  767.                     result = "EXP " + exp_earn.to_s
  768.                   #--------------------------------------------------------------
  769.                     damage(result, false,false,false)
  770.                   end
  771.                 elsif @_collapse_duration == GOLD and @battler.gain_exp_act == true
  772.                   if @battler.gold != 0
  773.                     #--------------------------------------------------------------
  774.                     # Difficulty Modifier
  775.                     gold_earn = @battler.gold
  776.                     gold_earn = gold_earn * $game_system.gold_rate / 100
  777.                     result = gold_earn.to_s + " " + $data_system.words.gold
  778.                     #--------------------------------------------------------------
  779.                     damage(result, false,false,false)
  780.                   end
  781.                   @xrxs_resultpop_done = true if $mog_rgss_ap_parameter == nil
  782.                 elsif $mog_rgss_ap_parameter != nil and @_collapse_duration == (GOLD / 2) and @battler.gain_exp_act == true
  783.                   if @battler.ap != 0
  784.                     result = @battler.ap.to_s + " " + MOG::AP_NAME
  785.                     damage(result, false,false,false)
  786.                   end
  787.                   @xrxs_resultpop_done = true    
  788.                 end
  789.               end
  790.             end
  791.           end
  792.         end
  793.         end # if USEING_DAMAGE_POP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement