estriole

EST - RACE TRAIT

Dec 13th, 2012
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.93 KB | None | 0 0
  1. $imported = {} if $imported.nil?
  2. $imported["EST-RACE"] = true
  3.  
  4. =begin
  5. ==============================================================================
  6.  ** EST - RACE TRAITS AND FEATURE 1.2
  7. ------------------------------------------------------------------------------
  8.  Author             : ESTRIOLE
  9.  Usage Level        : Easy
  10.  
  11.  licences:
  12.  Free to use in all project (except the one containing pornography)
  13.  as long as i credited (ESTRIOLE).
  14.  
  15.  also credits to FORMAR since i use his extra trait lv up as guide.
  16.  
  17.  modification for your own usage is permitted just don't claim this is yours
  18.  just add below the author: Modded by : ....
  19.  
  20.  Version History:
  21.   v 1.2 - 2012.10.08 > -  able to show 'fake' info in yanfly status script.
  22.   v 1.1 - 2012.10.07 > -  add more function for variable showing
  23.   v 1.0 - 2012.10.06 > -  finish the script
  24.  
  25. ------------------------------------------------------------------------------
  26.  This script assign traits to actors based on what race the actor is. actor
  27.  race assigned using notetags. and the traits added is using armors as reference
  28.  in the database.
  29. ------------------------------------------------------------------------------
  30.  How to use:
  31.  1) set your race in the configuration part below
  32.     a) set the name
  33.     b) set the armor id that it reference as trait adder. you could also assign
  34.        multiple armor since i made it arrays in case you have mixed race. ex:
  35.        hercules is half god half human. he gain both human and god trait.
  36.  2) create the armor that you assign as race trait and give it traits (ex:maxhp +100%,etc)
  37.  3) give tags to your actors
  38.  
  39.  <race: x>
  40.  
  41.  x is the race name you defined in the configuration (not case sensitive)
  42.  
  43.  from v1.2:
  44.  to set the 'fake' skill info to show in yanfly status menu. (fake because they
  45.  only text. the actual effect need to set in the armor)
  46.  1) set your skill in configuration skill text config (see the example format)
  47.  2) add in your race in ABILITYTEXT:
  48.  3) SKILL[:yourskill]
  49.  
  50.  Future Development
  51.  none
  52.  
  53.  Author Notes
  54.  none
  55.  
  56. =end
  57.  
  58. module ESTRIOLE
  59. ######## SKILL TEXT CONFIG ######################################
  60.   SKILL = {
  61.   COMBOGOD:["Combo God","Attack hit 9 times"],
  62.   FAST:["Fast","Agi +10%"],
  63.   CRAZYREGEN:["Crazy Regen","Regenerate HP 100% each turn"],
  64.   CRAZYMP:["Crazy MP","Max MP x 10"],
  65.   FORTITUDE:["Fortitude","Max Hp x 10"],
  66.   DOUBLEACTION:["Double Action","Act Twice in a turn"],
  67.   TENCOMMAND:["10th Command","Act 10 times in turn"],
  68.   }
  69.  
  70. ######## RACE CONFIGURATION PART ######################################
  71.   RACE = { # DO NOT TOUCH THIS LINE
  72.   1 => {
  73.             NAME: "HUMAN",  #this used in notetags: <race: human>
  74.             SHOWNNAME: "Human",  #this cosmetic version to use in variables
  75.             ARMOR_ID: [3], #array of armor id to add starting feature
  76.             ABILITYTEXT: [SKILL[:CRAZYREGEN],SKILL[:CRAZYMP]],  
  77.  
  78.             }, #remember the , people tend to forget this
  79.   2 => {
  80.             NAME: "ELF",
  81.             SHOWNNAME: "Elf",  #this cosmetic version to use in variables
  82.             ARMOR_ID: [4],
  83.             ABILITYTEXT: [SKILL[:COMBOGOD],SKILL[:FAST]],  
  84.             },
  85.   3 => {
  86.             NAME: "DWARF",
  87.             SHOWNNAME: "Dwarf",  #this cosmetic version to use in variables
  88.             ARMOR_ID: [5],
  89.             ABILITYTEXT: [SKILL[:FORTITUDE],SKILL[:DOUBLEACTION]],  
  90.             },
  91.   4 => {
  92.             NAME: "SPIRIT",
  93.             SHOWNNAME: "Spirit",  #this cosmetic version to use in variables
  94.             ARMOR_ID: [6],
  95.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  96.             },
  97.   5 => {
  98.             NAME: "FAIRY", #no spaces allowed if name have two words <race: half_elf>
  99.             SHOWNNAME: "Fairy",  #this cosmetic version to use in variables
  100.             ARMOR_ID: [7],
  101.             ABILITYTEXT: [
  102.             SKILL[:COMBOGOD],SKILL[:FAST],SKILL[:CRAZYREGEN],SKILL[:CRAZYMP]
  103.             ],                        
  104.             },
  105.   6 => {
  106.             NAME: "GHOST",
  107.             SHOWNNAME: "Ghost",  #this cosmetic version to use in variables
  108.             ARMOR_ID: [8],
  109.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  110.             },
  111.   7 => {
  112.             NAME: "MAGIA",
  113.             SHOWNNAME: "Magia",  #this cosmetic version to use in variables
  114.             ARMOR_ID: [9],
  115.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  116.             },
  117.   8 => {
  118.             NAME: "CATEL",
  119.             SHOWNNAME: "Catel",  #this cosmetic version to use in variables
  120.             ARMOR_ID: [10],
  121.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  122.             },
  123.   9 => {
  124.             NAME: "ROBOT",
  125.             SHOWNNAME: "Robot",  #this cosmetic version to use in variables
  126.             ARMOR_ID: [11],
  127.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  128.             },
  129.   10 => {
  130.             NAME: "DRACULA",
  131.             SHOWNNAME: "Dracula",  #this cosmetic version to use in variables
  132.             ARMOR_ID: [12],
  133.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  134.             },
  135.   11 => {
  136.             NAME: "WEREWOLF",
  137.             SHOWNNAME: "Werewolf",  #this cosmetic version to use in variables
  138.             ARMOR_ID: [13],
  139.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  140.             },
  141.   12 => {
  142.             NAME: "EARTHDATA",
  143.             SHOWNNAME: "Earth Data",  #this cosmetic version to use in variables
  144.             ARMOR_ID: [14],
  145.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  146.             },
  147.   13 => {
  148.             NAME: "ADMIN",
  149.             SHOWNNAME: "Administrator",  #this cosmetic version to use in variables
  150.             ARMOR_ID: [15],
  151.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  152.             },
  153.   14 => {
  154.             NAME: "EARTHLING",
  155.             SHOWNNAME: "Human - Earth",  #this cosmetic version to use in variables
  156.             ARMOR_ID: [2],
  157.             ABILITYTEXT: [SKILL[:TENCOMMAND]],  
  158.             },
  159.            
  160.   }# DO NOT TOUCH THIS LINE
  161.  
  162.   USE_DEFAULT_RACE = false
  163.   DEFAULT_RACE = 1
  164.  
  165. ####### END RACE CONFIGURATION PART ###################################
  166.   RACE_TAG = /<(?:RACE|TRIBE):\s*(\w+)>/i
  167. #  RACE_TAG = /<race:[ ]*(\w+.)>/i
  168.  
  169. end
  170.  
  171. #load notetags part
  172. class RPG::Actor < RPG::BaseItem
  173.   attr_accessor :race
  174.   def load_notetags_race
  175.       if ESTRIOLE::USE_DEFAULT_RACE
  176.       @race = ESTRIOLE::RACE[ESTRIOLE::DEFAULT_RACE][:NAME]
  177.       else
  178.       @race = nil
  179.       end
  180.       self.note.split(/[\r\n]+/).each { |line|
  181.       case line
  182.       when ESTRIOLE::RACE_TAG
  183.         @race = $1
  184.       end
  185.       } #end note split
  186.   end
  187. end
  188.  
  189. module DataManager
  190.  
  191.   #--------------------------------------------------------------------------
  192.   # alias method: load_database
  193.   #--------------------------------------------------------------------------
  194.   class <<self; alias load_database_est_race1234 load_database; end
  195.   def self.load_database
  196.     load_database_est_race1234
  197.     load_notetags_est_race_333
  198.   end
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # new method: load_notetags_armpos
  202.   #--------------------------------------------------------------------------
  203.   def self.load_notetags_est_race_333
  204.       for obj in $data_actors
  205.         next if obj.nil?
  206.         obj.load_notetags_race
  207.       end
  208.       puts "Read: actor race Notetags"
  209.   end  
  210. end # DataManager
  211.  
  212.  
  213. class Game_Actor < Game_Battler
  214.  
  215.   alias est_race_feature_setup setup
  216.   def setup(actor_id)
  217.   @race_features = Race_Features.new
  218.   @race_features.features = []
  219.   set_race_features(actor_id) if $data_actors[actor_id].race != nil
  220.   est_race_feature_setup(actor_id)
  221.   end
  222.  
  223.   def get_armor_race(id)
  224.     for i in 1..ESTRIOLE::RACE.size
  225.     actor_race = $data_actors[id].race
  226.     check = /#{actor_race}/i.match(ESTRIOLE::RACE[i][:NAME])      
  227.     return ESTRIOLE::RACE[i][:ARMOR_ID] if check
  228.     end
  229.     return nil
  230.   end
  231.  
  232.   def get_race_name
  233.     for i in 1..ESTRIOLE::RACE.size
  234.     actor_race = $data_actors[@actor_id].race
  235.     next if !actor_race
  236.     check = /#{actor_race}/i.match(ESTRIOLE::RACE[i][:NAME])      
  237.     return ESTRIOLE::RACE[i][:SHOWNNAME] if check
  238.     end
  239.     return nil
  240.   end
  241.  
  242.   def get_ability_text
  243.     for i in 1..ESTRIOLE::RACE.size
  244.     actor_race = $data_actors[@actor_id].race
  245.     next if !actor_race
  246.     check = /#{actor_race}/i.match(ESTRIOLE::RACE[i][:NAME])      
  247.     return ESTRIOLE::RACE[i][:ABILITYTEXT] if check
  248.     end
  249.     return nil
  250.   end  
  251.  
  252.   def set_race_features(id)
  253.   armor_ref = get_armor_race(id)
  254.     if armor_ref!=nil
  255.       for i in 0..armor_ref.size-1
  256.       @race_features.features += $data_armors[armor_ref[i].to_i].features
  257.       end
  258.     end
  259.   end  
  260.  
  261.   def change_race(race_name)
  262.   #change race
  263.   $data_actors[@actor_id].race = race_name
  264.   @race_features.features = []
  265.   set_race_features(@actor_id) if $data_actors[@actor_id].race != nil
  266.   end
  267.  
  268.   alias est_feature_objects feature_objects
  269.   def feature_objects
  270.     est_feature_objects + [@race_features]
  271.   end
  272.  
  273. end
  274.  
  275.  
  276. class Race_Features
  277.   attr_accessor :features
  278. end
Advertisement
Add Comment
Please, Sign In to add comment