Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===========================================================================
- #
- # Sky's Enemy (Up/De)grading by Turn
- # Version 1.0
- # Started May 21, 2010
- # Comlete May 22, 2010
- #
- #===========================================================================
- #
- # Features :
- # Version 1.0 -
- # - Enemies get stronger or weaker every
- # certain amount of turns.
- #
- #===========================================================================
- #
- # Credit (be sure to credit the following and rpgmakervx.net)
- # Sky00Valentine :creator and editor (You aren't required to include me, but I wouldn't mind if you did.)
- # //mitch.exe :for requesting the script
- #
- #===========================================================================
- #
- # Terms of Use
- # ------------
- #
- # Crediting Rpgmakervx.net and //mitch.exe is the only thing I ask.
- # However feel free to credit Sky00Valentine if you
- # see fit.
- #
- #===========================================================================
- #
- # Future improvement
- # ------------------
- #
- # - Adding the ability to add or change states also(im lazy right now)
- # - Adding the ability to stop upgrading or degrading after a set number
- # of times.
- # - Adding the ability to change stats based on a different stat.
- # - Maybe adding in custom stats as well.
- #
- #===========================================================================
- #
- # Instructions & Installation
- # ---------------------------
- # - add under any custom battle scripts and/or Materials
- #
- # - These are the 'commands' you add to an enemy's notebox
- #
- # command is basically what you want to do
- # x:y (x is the number you want to use)
- # (: stands for per)
- # (y is the number of turns)
- # so 3:2 means 3 per 2 turns
- # this will be repeated below to help understand after you see the actual
- # commands
- #
- # command x:y
- # | |
- # | |
- # V V
- # <ATKCON+ x:y> --> Adds a constant number to enemy attack
- # <DEFCON+ x:y> --> Adds a constant number to enemy defense
- # <AGICON+ x:y> --> Adds a constant number to enemy agility
- # <SPICON+ x:y> --> Adds a constant number to enemy spirit
- # <ATKCON- x:y> --> Subracts a constant number from enemy attack
- # <DEFCON- x:y> --> Subracts a constant number from enemy defense
- # <AGICON- x:y> --> Subracts a constant number from enemy agility
- # <SPICON- x:y> --> Subracts a constant number from enemy spirit
- # <ATKPER+ x:y> --> Adds a percentage of enemy attack to enemy attack
- # <DEFPER+ x:y> --> Adds a percentage of enemy attack to enemy defense
- # <AGIPER+ x:y> --> Adds a percentage of enemy attack to enemy agility
- # <SPIPER+ x:y> --> Adds a percentage of enemy attack to enemy spirit
- # <ATKPER- x:y> --> Subtracts a percentage of enemy attack from enemy attack
- # <DEFPER- x:y> --> Subtracts a percentage of enemy attack from enemy defense
- # <AGIPER- x:y> --> Subtracts a percentage of enemy attack from enemy agility
- # <SPIPER- x:y> --> Subtracts a percentage of enemy attack from enemy spirit
- #
- #
- # command is basically what you want to do
- # x:y (x is the number you want to use)
- # (: stands for per)
- # (y is the number of turns)
- # so <ATKCON+ 10:4> means this enemy will gain 10 more attack every 4 turns
- # <AGIPER- 5:10> means this enemy will lose 5 percent of thier current
- # agility every 10 turns
- #
- #===========================================================================
- #
- # Compatibility & Bugs
- # --------------------
- # Not sure if this will work with other custom battle scripts but
- # it should as far as I can tell.
- #
- #===========================================================================
- class Scene_Battle
- alias get_stronger_by_turn turn_end
- def turn_end
- for i in 0...$game_troop.members.size
- text = $game_troop.members[i].enemy.note
- unless $game_troop.members[i].dead?
- text.each_line{|x| line = x[0,x.index(">") + 1]
- unless line == nil
- variable_list = line[9..(line.index('>') - 1)]
- variables = variable_list.split(":")
- if line.include?("<ATKCON")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].atk += variables[0].to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].atk -= variables[0].to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<DEFCON")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].def += variables[0].to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].def -= variables[0].to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<AGICON")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].agi += variables[0].to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].agi -= variables[0].to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<SPICON")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].spi += variables[0].to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].spi -= variables[0].to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<ATKPER")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].atk += (($game_troop.members[i].atk / 100.0 * variables[0].to_i).round).to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].atk -= (($game_troop.members[i].atk / 100.0 * variables[0].to_i).round).to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<DEFPER")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].def += (($game_troop.members[i].def / 100.0 * variables[0].to_i).round).to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].def -= (($game_troop.members[i].def / 100.0 * variables[0].to_i).round).to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<AGIPER")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].agi += (($game_troop.members[i].agi / 100.0 * variables[0].to_i).round).to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].agi -= (($game_troop.members[i].agi / 100.0 * variables[0].to_i).round).to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- if line.include?("<SPIPER")
- if line[7,1] == "+"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].spi += (($game_troop.members[i].spi / 100.0 * variables[0].to_i).round).to_i
- end
- elsif line[7,1] == "-"
- if ($game_troop.turn_count % variables[1].to_i) == 0
- $game_troop.members[i].spi -= (($game_troop.members[i].spi / 100.0 * variables[0].to_i).round).to_i
- end
- else
- raise Exception.new("#{line[7,1]} is not a valid function")
- end
- end
- end
- }
- end
- end
- get_stronger_by_turn
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement