Advertisement
Falmc

Falcao pets servants 1.2

Oct 4th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 81.23 KB | None | 0 0
  1. #==============================================================================#
  2. #  #*****************#                                                         #
  3. #  #*** By Falcao ***#          * Falcao Pets Servants System 1.2              #
  4. #  #*****************#          This script allow you to have pet servants     #
  5. #                               that perform a avance command system helping   #
  6. #       RMVXACE                 the game player to complete tasks.             #
  7. #                               Date: Octuber 4 2012                           #
  8. #                                                                              #
  9. # Falcao RGSS site:  http://falcaorgss.wordpress.com                           #
  10. # Falcao Forum site: http://makerpalace.com                                    #
  11. #                                                                              #
  12. #==============================================================================#
  13.  
  14. #-------------------------------------------------------------------------------
  15. # * Installation
  16. #
  17. # Paste this script above main, no graphics required just copy and paste it into
  18. # your project, 5 item have been created in the database, witch are the gift
  19. # bundle items, if you are using my FA Interactive system 2.0 paste this script
  20. # below it, commons events has been created, to show how to make custom commands
  21. #
  22. #-------------------------------------------------------------------------------
  23. # * Features
  24. #
  25. # - Create as many pets you want at the pet factory below
  26. # - Assigns commands to the pets (you can create as many command you want)
  27. # - Pets level up
  28. # - Pets have a mood bar
  29. # - Pets give a gift bunndle when mood reach the maximun
  30. # - Each pet  give special bonus when is in use
  31. # - A avance command action system is implemented such as
  32. #   pet Steal, pet Grab objects, Pet Trigger targets, Pet Climb etc
  33. # - Pet minder Shop available!
  34. # - You can assign unique commands for each pet
  35. # - Pet are able to: create item, weapons, armor, gold, heal party, increase
  36. #   mood when dancing or playing with pet
  37. # - Custom command system implemented, so you can create your own fully
  38. #   custamizable commands via common events.
  39. # - Commands cooldown system, that mean you can assigh waiting time to each
  40. #   command available
  41. # - Mouse system buttons support!, you can select targets with the mouse in case
  42. #   you are using my mouse system buttons script
  43. #  
  44. #-------------------------------------------------------------------------------
  45. # * Compatibility
  46. #
  47. # Despite the complex of this system, i design this script to be compatible with
  48. # any other script, tested with ABS systems, pixel movement system etc
  49. #-------------------------------------------------------------------------------
  50. # * License
  51. #
  52. # For non-comercial games only
  53. # If you need this script for comercial games contact me  falmc99@gmail.com
  54. #-------------------------------------------------------------------------------
  55.  
  56. #-------------------------------------------------------------------------------
  57. #                            * Game flow usage
  58. #
  59. # Use the following events comments tags to complete pet tasks
  60. #
  61. # /PET TRIGGER             - The event start when touched by the pet, it is
  62. #                            usable with 'Trigger Targets cmd'
  63. # /PET CLIMB               - This make the event as a referencial point for
  64. #                            the command climb
  65. # /PET GRAB                - The event become grab-able for the pet
  66. #
  67. # /PET STEAL ITEM x        - Intead x put the item id you want the pet to steal
  68. #                            from the event. ex: PET STEAL ITEM 1
  69. # /PET STEAL WEAPON x      - Instead x put weapon id you want the pet to steal
  70. #                            from the event. ex: /PET STEAL WEAPON 5
  71. # /PET STEAL ARMOR x       - Instead x put armor id you want the pet to steal
  72. #                            from the event. ex: /PET STEAL ARMOR 3
  73. # /PET STEAL GOLD x        - Instead x put gold amount you want the pet to steal
  74. #                            from the event. ex: /PET STEAL GOLD 35
  75. # /PET STEAL CHANCE 1 / x  - Instead x put the probability to steal any kind
  76. #                            ex: /PET STEAL CHANCE 1 / 3 (chance one of three)
  77. # /IGNORE TARGETING          The tags above use a event target to perform action
  78. #                            this will avoid events on map from being targeted
  79. #
  80. # Important note:
  81. # The pet take only one task from the steal command per event, so if you assign
  82. # steal items, the pet going to steal items nothing else.
  83. #-------------------------------------------------------------------------------
  84. #                       * In-Game script calls
  85. #
  86. # SceneManager.call(Scene_PetShop)      Call the pet minder Shop
  87. # SceneManager.call(Scene_PetCommands)  Call manually the pet command window
  88. #
  89. # $game_player.gamepet.mood_cmd(x)      Instead x put mood command id to add  
  90.  
  91. # $game_player.adopt_pet(x)             If you dont want to buy pets from the
  92. #                                       shop you can add them manually, instead
  93. #                                       x put pet id from the pet factory
  94. #
  95. # See game demo for details and examples.
  96. #-------------------------------------------------------------------------------
  97.  
  98. module FalPet
  99.  
  100. #=============================================================================
  101. # * Pets global settings
  102.  
  103. # Starting Mood Maximun
  104.   StartingMoodMax = 30
  105.  
  106. # After how many gifts the pet level up?
  107.   Growing = 3
  108.  
  109. # Amount added to to the StartingMoodMax value when pet level up
  110.   MoodMaxPlus = 18
  111.  
  112. # The pet give you a gift when level up, define here the level and the gift
  113. # The maximun level will be the maximun gift
  114. # A = pet level   B = Item id
  115.   GiftBundle = {
  116.  
  117.   1 => 17,
  118.   2 => 18,
  119.   3 => 19,
  120.   4 => 20,
  121.   5 => 21,
  122.  
  123.   }
  124.  
  125. # Ballon id showed when the pet play
  126.   BalloonPlaying = 1
  127.  
  128. # Balloon played when pet play dead
  129.   PlayDeadBalloon = 8
  130.  
  131. # BGM played when pet dancing
  132.   DancingBgm = "Town7"
  133.  
  134. # Mood text when pet mood is low
  135.   MoodLowText = 'Feels sad...'
  136.  
  137. # Mood text when pet mood is overage
  138.   MoodOverageText = 'Feels content!'
  139.  
  140. # Mood text when pet mood is medium
  141.   MoodMediumText = 'Loves you!'
  142.  
  143. # Mood text when pet mood is hight
  144.   MoodHight = 'Want pussy!'
  145.  
  146. # Cursor icon index showed when selecting and event target
  147.   CursorIcon = 389
  148.  
  149. # Pet get stacked sometimes when performing action task such as Climb, Grab etc
  150. # after how many stucked times pet give up?
  151.   StuckCount = 15
  152.  
  153. # Buttom to call the pet commands, (W key from the keyboard)
  154.   CommandsKey = :R
  155.  
  156. # Do you want to use the key? you can call the scene commands manually
  157.   UseKey = true
  158.  
  159. #=============================================================================
  160. #                      * Pet Factory
  161. #
  162. # You can create as many pets you want, set the prices, set speciallity skills
  163. # for each pet and give the entire party a bonus when using the pet, 10 pets
  164. # has been created as examples.
  165. #
  166.  
  167.   Pets = {
  168.                                                 #-----------------------------#
  169.                                                 #           * Sounds          #
  170.                                                 #
  171. # Pet Id      Graphic    Index     Name            Voice       Vol     Pitch
  172.     1   =>  ["Animal",     0,    "Isidoro",       "Dog",       80,     150],
  173.     2   =>  ["Animal",     1,    "Mitcha",        "Cat",       80,     100],
  174.     3   =>  ["Spiritual",  5,    "Navis",         "Ice1",      100,    100],
  175.     4   =>  ["Animal",     3,    "Gordura",       "Coin",      80,     100],
  176.     5   =>  ["Animal",     4,    "Fart Cow",      "Cow",       80,     100],
  177.     6   =>  ["Animal",     5,    "Laziness",      "Horse",     80,     120],
  178.     7   =>  ["Animal",     6,    "Coyote",        "Wolf",     100,     150],
  179.     8   =>  ["Monster3",   5,    "Draconic",      "Monster6",  80,     150],
  180.     9   =>  ["Monster3",   7,    "Spiderpussy",   "Monster3",  80,     150],
  181.     10  =>  ["Monster3",   4,    "Rataliony",     "Miss",      80,     100],
  182.  
  183.   }
  184.  
  185. # Edit the pet prices, this will be the price displayed at the pet shop
  186.   Price = {
  187.  
  188. #   Pet id   Price
  189.      1  =>   10000,
  190.      2  =>   200,
  191.      3  =>   700,
  192.      4  =>   100,
  193.      5  =>   500,
  194.      6  =>   3000,
  195.      7  =>   6000,
  196.      8  =>   8000,
  197.      9  =>   5000,
  198.      10 =>   900,
  199.      
  200.      
  201.  
  202.   }
  203.  
  204. # You can assign especific specialities for each pet, there are 16 commands
  205. # Availables listed below. (listed default ones only, you can create more!)
  206.  
  207. # 10 = Trigger Targets  14 = Heal Party       18 = Create Gold   22 = Custom4
  208. # 11 = Steal Items      15 = Create Items     19 = Rainsing S    23 = Custom5
  209. # 12 = Grab objects     16 = Create Weapons   20 = Custom2       24 = Custom6
  210. # 13 = Climb            17 = Create Armors    21 = Custom3       25 = Custom7
  211. #
  212. # Each command id going inside the arrays below
  213.   Speciality = {
  214.  
  215. # Pet id    Command Speciality ids
  216.     1  =>  [10, 11, 12, 13, 14, 15, 16, 17, 18],
  217.     2  =>  [16],
  218.     3  =>  [14, 19, 21],
  219.     4  =>  [17],
  220.     5  =>  [15],
  221.     6  =>  [12],
  222.     7  =>  [11],
  223.     8  =>  [10, 20],
  224.     9  =>  [13],
  225.     10 =>  [18],
  226.    
  227.   }
  228.  
  229.  
  230. # Game party guarantee a bonus when using specific pet, each parameters is added
  231. # when the pet is in use, and it is losed when you equip another pet
  232. # This is oriented to the 8 parameters available in game, this make a huge
  233. # diference for each pet. see examples below
  234.  
  235.   Bonus = {
  236.  
  237. # Pet id                 * Bonus Parameters
  238.     1  => [mhp =  10,   mmp =   0,   atk =   0,  defe =   0,
  239.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  240.          
  241.     2  => [mhp =  20,   mmp =  20,   atk =   2,  defe =  10,
  242.            mat =   1,   mdf =   1,   agi =  10,  luk  =  10],
  243.          
  244.     3  => [mhp = 200,   mmp = 200,   atk =   0,  defe =   20,
  245.            mat =   6,   mdf =   6,   agi =   0,  luk  =   0],
  246.  
  247.     4  => [mhp =   0,   mmp =   0,   atk =  10,  defe =   120,
  248.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  249.          
  250.     5  => [mhp = 100,   mmp =  50,   atk =   0,  defe =   0,
  251.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  252.          
  253.     6  => [mhp =   0,   mmp =   0,   atk =  10,  defe =   0,
  254.            mat =   0,   mdf =   0,   agi =   0,  luk  =  50],
  255.          
  256.     7  => [mhp =   0,   mmp =   0,   atk =   0,  defe =  60,
  257.            mat =   0,   mdf =  11,   agi =  10,  luk  =  10],
  258.  
  259.     8  => [mhp =  60,   mmp =  60,   atk =   9,  defe =   0,
  260.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  261.          
  262.     9  => [mhp =  50,   mmp =  50,   atk =  10,  defe =   0,
  263.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  264.    
  265.     10 => [mhp =   0,   mmp =   0,   atk =   0,  defe =  6,
  266.            mat =   0,   mdf =   0,   agi =  14,  luk  =  11],    
  267.          
  268.   }
  269.  
  270.  
  271. #=============================================================================
  272. #               * Pet Commands configuration
  273. #
  274. # There are 3 types of commands available, Defaults, Mood gain and Speciality
  275. #
  276. #- Defaults commands are the basics and are always available for the pets
  277. #- Moods gain commands are those commands that increase the mood of the pet
  278. #  by performing an act, like playing with pet, dancing atc.
  279. #- Speciality commands give the pet tasks to do, this category breaks into 3
  280. #  sub-categories such, Action, Casting and Custom
  281. #
  282. # Terms explanation
  283. #
  284. # Cmd_Name           - Command name
  285. # Cmd_IconIndex      - Command icon index
  286. # Cmd_Description    - Command short description
  287. # Cmd_CoolDown       - Cool Down is the time you have to wait to use a command
  288. #                      again, time is measured in seconds
  289. #
  290. # Cmd_MoodGain       - Amount of mood added to the pet when using a mood command
  291. # Cmd_ActionTime     - Time in frames of the command duration (only for custom)
  292. #
  293.  
  294. #===============================================================================
  295. # * Deafault commands
  296.  
  297.   # command 1
  298.   Cmd1_Name = 'Toggle Pet'
  299.   Cmd1_IconIndex = 217
  300.   Cmd1_Description = 'Toggle pet on off'
  301.   Cmd1_CoolDown = 0
  302.  
  303.   # command 26
  304.   Cmd26_Name = 'Adopted pets'
  305.   Cmd26_IconIndex = 168
  306.   Cmd26_Description = 'List of adopted pets'
  307.   Cmd26_CoolDown = 0
  308.  
  309. #=============================================================================
  310. # * Mood gain commands (Play commands)
  311. #
  312. # There are 8 default moods commands available listed below
  313. #
  314. # 2 = Jumpa          4 = Take a breath   6 = Make a twist  8 = Dance
  315. # 3 = Turn around    5 = Chase jump      7 = Play dead     9 = Trampoline
  316. #
  317. # Moods commands are added manually to menu, use the next script calls to add
  318. # $game_player.gamepet.mood_cmd(id)       id = id of the mood command
  319.  
  320. # You can also set defaults mood commands, they will be added automatically
  321.   DeafaultMoodCommands = [2]
  322.  
  323.   # command 2
  324.   Cmd2_Name = 'Jumpa'
  325.   Cmd2_IconIndex = 122
  326.   Cmd2_Description = 'Perform jumps showing happiness'
  327.   Cmd2_CoolDown = 8
  328.   Cmd2_MoodGain = 4
  329.  
  330.   # command 3
  331.   Cmd3_Name = 'Turn around'
  332.   Cmd3_IconIndex = 12
  333.   Cmd3_Description = 'Turn around command'
  334.   Cmd3_CoolDown = 20
  335.   Cmd3_MoodGain = 8
  336.  
  337.   # command 4
  338.   Cmd4_Name = 'Take a breath'
  339.   Cmd4_IconIndex = 177
  340.   Cmd4_Description = 'Pet take a big breath'
  341.   Cmd4_CoolDown = 10
  342.   Cmd4_MoodGain = 6
  343.  
  344.   # command 5
  345.   Cmd5_Name = 'Chase jump'
  346.   Cmd5_IconIndex = 176
  347.   Cmd5_Description = 'Jump to his handsome owner'
  348.   Cmd5_CoolDown = 18
  349.   Cmd5_MoodGain = 10
  350.  
  351.   # command 6
  352.   Cmd6_Name = 'Make a twist'
  353.   Cmd6_IconIndex = 103
  354.   Cmd6_Description = 'Play twist'
  355.   Cmd6_CoolDown = 30
  356.   Cmd6_MoodGain = 16
  357.  
  358.   # command 7
  359.   Cmd7_Name = 'Play dead'
  360.   Cmd7_IconIndex = 1
  361.   Cmd7_Description = 'Play dead emote'
  362.   Cmd7_CoolDown = 60
  363.   Cmd7_MoodGain = 22
  364.  
  365.   # command 8
  366.   Cmd8_Name = 'Dance'
  367.   Cmd8_IconIndex = 118
  368.   Cmd8_Description = 'Pet start dancing!'
  369.   Cmd8_CoolDown = 120
  370.   Cmd8_MoodGain = 46
  371.  
  372.   # command 9
  373.   Cmd9_Name = 'Trampoline'
  374.   Cmd9_IconIndex = 119
  375.   Cmd9_Description = 'Start making a trampoline!'
  376.   Cmd9_CoolDown = 120
  377.   Cmd9_MoodGain = 36
  378.  
  379. #=============================================================================
  380. # * Pet speciality commands configurations
  381. #=============================================================================
  382. # * Action commands
  383.  
  384.   # command 10
  385.   Cmd10_Name = 'Trigger Targets'
  386.   Cmd10_IconIndex = 398
  387.   Cmd10_Description = 'Command the Pet to trigger selected targets'
  388.   Cmd10_CoolDown = 0
  389.  
  390.   # command 11
  391.   Cmd11_Name = 'Steal items'
  392.   Cmd11_IconIndex = 9
  393.   Cmd11_Description = 'Command the pet to steal items and money'
  394.   Cmd11_CoolDown = 0
  395.  
  396.   # command 12
  397.   Cmd12_Name = 'Grab objects'
  398.   Cmd12_IconIndex = 491
  399.   Cmd12_Description = 'Command the pet to grab selected objects'
  400.   Cmd12_CoolDown = 0
  401.  
  402.   # command 13
  403.   Cmd13_Name = 'Climb'
  404.   Cmd13_IconIndex = 275
  405.   Cmd13_Description = 'Command the pet to help the owner to climb'
  406.   Cmd13_CoolDown = 0
  407.  
  408. #=============================================================================
  409. # * Casting commands
  410.  
  411.   # command 14
  412.   Cmd14_Name = 'Heal Party'
  413.   Cmd14_IconIndex = 14
  414.   Cmd14_Description = 'Heal hp and mp for a fixed percentage'
  415.   Cmd14_CoolDown = 60
  416.  
  417.   # This casting command heals your entire party by a percentage, there are four
  418.   # available: '25%'  '50%'   '75%'  '100%'
  419.   HealPercent = '75%'
  420. #---------------------
  421.  
  422.   # command 15
  423.   Cmd15_Name = 'Create Items'
  424.   Cmd15_IconIndex = 213
  425.   Cmd15_Description = 'Create random items for the owner party'
  426.   Cmd15_CoolDown = 120
  427.  
  428.   # Animation played when pet is creating items
  429.   ItemAnime = 107
  430.  
  431.   # This command give you random items, add the participants items below
  432.   # A => B     A = Item id    B = Quantity
  433.   RandomItems = {
  434.  
  435.   1 =>  10,
  436.   2 =>  25,
  437.   6 =>  35,
  438.  
  439.   }
  440. #-----------------------
  441.  
  442.   # command 16
  443.   Cmd16_Name = 'Create Weapons'
  444.   Cmd16_IconIndex = 402
  445.   Cmd16_Description = 'Create random weapons for the owner party'
  446.   Cmd16_CoolDown = 240
  447.  
  448.   # Animation played when pet is creating weapons
  449.   WeaponAnime = 107
  450.  
  451.   # This command give you random weapons, add the participants weapons below
  452.   # A => B     A = Weapon id    B = Quantity
  453.   RandomWeapons = {
  454.  
  455.   1 => 11,
  456.   2 => 2,
  457.   6 => 7,
  458.  
  459.   }
  460. #-------------------------
  461.  
  462.   # command 17
  463.   Cmd17_Name = 'Create Armors'
  464.   Cmd17_IconIndex = 170
  465.   Cmd17_Description = 'Create random armors for the owner party'
  466.   Cmd17_CoolDown = 300
  467.  
  468.   # Animation played when pet is creating armors
  469.   ArmorAnime = 107
  470.  
  471.   # This command give you random armors, add the participants armors below
  472.   # A => B     A = Armor id    B = Quantity
  473.   RandomArmors = {
  474.  
  475.   1 => 17,
  476.   2 => 2,
  477.   6 => 8,
  478.  
  479.   }
  480. #--------------------------
  481.   # command 18
  482.   Cmd18_Name = 'Create Gold'
  483.   Cmd18_IconIndex = 344
  484.   Cmd18_Description = 'Create random Gold for the owner party'
  485.   Cmd18_CoolDown = 180
  486.  
  487.   # Animation played when pet is creating gold
  488.   GoldAnime = 107
  489.  
  490.   # This command give you random gold, add the gold amount partisipant
  491.   # Random gold amount go inside the array
  492.   RandomGold = [100, 25, 77, 45, 88]
  493.  
  494.  
  495. #--------------------------
  496.   # command 19
  497.   Cmd19_Name = 'Raising Spirit'
  498.   Cmd19_IconIndex = 112
  499.   Cmd19_Description = 'For short time cool down become instant!'
  500.   Cmd19_CoolDown = 600
  501.  
  502.   # Instant cool down buff duration in seconds
  503.   BuffDuration = 60
  504.  
  505. #=============================================================================
  506. # * Custom commands
  507. #
  508. # Custom commands are designed to work via common events, a switch is activated
  509. # when the command time is running and it is deactivated when time ends.
  510. # So the common event should be parallel process as condition the switch
  511. # assigned below
  512.  
  513.   # Switch id that remains active when a custom command is running
  514.   CustomSwitch = 100
  515.  
  516. # List of special tasks you can give the pet inside the common event
  517. # when a custom command is running
  518. #
  519. # * Basics
  520. #
  521. # pet                  Get currently using pet
  522. # pet.cmd(id)          Get pet command (change id for command id integer)
  523. # pet.time?(x)         Get current command action time (change x for an integer)
  524. # pet.level            Get currently pet level
  525. # pet.ending?          Check if action time command is about to finish
  526. #
  527. # * Actions
  528. #
  529. # pet.prepare          Player and pet turn face to face  
  530. # pet.liedown          Pet lie down                
  531. # pet.reset_liedown    Pet stand up
  532. # pet.cast             Pet make a casting position
  533. # pet.jump_high(x,y,h) Jump higher than normal, chan x,y,h for an integer
  534. # pet.play_voice       Play the pet voice
  535. # pet.pop_mood         Pet start gaining the custom command mood assigned
  536. # pet.pop_text(t,time) Pet start poping a window with custom text, change
  537. #                      t for 'text to display' and time for time in seconds
  538. # pet.zoom(x, y)       Pet start zooming, change x,y for desire integers,  
  539. #                      zoom support decimals.
  540. # pet.reset_zoom       Reset zoom to normal size        
  541. #
  542. # Those are just special commands for the pet, since the pet is a character
  543. # he can use any command from the move route such as, move_up,
  544. # animation_id, balloon_id, move_away_from_player etc.
  545.  
  546.   # command 20
  547.   Cmd20_Name = 'Sleep'
  548.   Cmd20_IconIndex = 6
  549.   Cmd20_Description = 'Start sleeping'
  550.   Cmd20_CoolDown = 40
  551.   Cmd20_MoodGain = 12
  552.   Cmd20_ActionTime = 300
  553.   Cmd20_Type = 'Mood +'
  554.  
  555.   # command 21
  556.   Cmd21_Name = 'Iron Body'
  557.   Cmd21_IconIndex = 13
  558.   Cmd21_Description = 'Cast a magic shield'
  559.   Cmd21_CoolDown = 120
  560.   Cmd21_MoodGain = 0
  561.   Cmd21_ActionTime = 200
  562.   Cmd21_Type = 'Casting'
  563.  
  564.   # command 22
  565.   Cmd22_Name = 'Command name'
  566.   Cmd22_IconIndex = 344
  567.   Cmd22_Description = 'Any description'
  568.   Cmd22_CoolDown = 5
  569.   Cmd22_MoodGain = 0
  570.   Cmd22_ActionTime = 200
  571.   Cmd22_Type = ''
  572.  
  573.   # command 23
  574.   Cmd23_Name = 'Command name'
  575.   Cmd23_IconIndex = 344
  576.   Cmd23_Description = 'Any description'
  577.   Cmd23_CoolDown = 5
  578.   Cmd23_MoodGain = 0
  579.   Cmd23_ActionTime = 200
  580.   Cmd23_Type = ''
  581.  
  582.   # command 24
  583.   Cmd24_Name = 'Command name'
  584.   Cmd24_IconIndex = 344
  585.   Cmd24_Description = 'Any description'
  586.   Cmd24_CoolDown = 5
  587.   Cmd24_MoodGain = 0
  588.   Cmd24_ActionTime = 200
  589.   Cmd24_Type = ''
  590.  
  591.   # command 25
  592.   Cmd25_Name = 'Command name'
  593.   Cmd25_IconIndex = 344
  594.   Cmd25_Description = 'Any description'
  595.   Cmd25_CoolDown = 5
  596.   Cmd25_MoodGain = 0
  597.   Cmd25_ActionTime = 200
  598.   Cmd25_Type = ''
  599.  
  600.   #-----------------------------------------------------------------------------
  601.   # * Commands database
  602.   Commands = {
  603.  
  604.   1 =>  [Cmd1_Name,   c = 1, ii = Cmd1_IconIndex,  t = 0,   tg = false, nil,
  605.          Cmd1_Description, Cmd1_CoolDown, 0, ty = 'Triggering'],
  606.   2 =>  [Cmd2_Name,  c = 2, Cmd2_IconIndex,      t = 160, tg = false, nil,
  607.          Cmd2_Description, Cmd2_CoolDown, Cmd2_MoodGain, ty = 'Mood +'],
  608.   3 =>  [Cmd3_Name, c = 3, Cmd3_IconIndex, t = 160, tg = false, nil,
  609.          Cmd3_Description, Cmd3_CoolDown, Cmd3_MoodGain, ty = 'Mood +'],
  610.   4 =>  [Cmd4_Name,      c = 4, ii = Cmd4_IconIndex,  t = 160, tg = false, nil,
  611.          Cmd4_Description, Cmd4_CoolDown, Cmd4_MoodGain, ty = 'Mood +'],
  612.   5 =>  [Cmd5_Name,      c = 5, Cmd5_IconIndex,  t = 160, tg = false, nil,
  613.          Cmd5_Description, Cmd5_CoolDown, Cmd5_MoodGain, ty = 'Mood +'],
  614.   6 =>  [Cmd6_Name,      c = 6, Cmd6_IconIndex,  t = 200, tg = false, nil,
  615.          Cmd6_Description, Cmd6_CoolDown, Cmd6_MoodGain, ty = 'Mood +'],
  616.   7 =>  [Cmd7_Name,      c = 7, Cmd7_IconIndex,  t = 500, tg = false, nil,
  617.          Cmd7_Description, Cmd7_CoolDown, Cmd7_MoodGain, ty = 'Mood +'],
  618.   8 =>  [Cmd8_Name,      c = 8, Cmd8_IconIndex,  t = 500, tg = false, nil,
  619.          Cmd8_Description, Cmd8_CoolDown, Cmd8_MoodGain, ty = 'Mood +'],
  620.   9 =>  [Cmd9_Name,      c = 9, Cmd9_IconIndex,  t = 400, tg = false, nil,
  621.          Cmd9_Description, Cmd9_CoolDown, Cmd9_MoodGain, ty = 'Mood +'],
  622.   #----------------------- # Actions
  623.   10 => [Cmd10_Name,    c = 10,  Cmd10_IconIndex, t = 0,   tg = true, nil,
  624.          Cmd10_Description, Cmd10_CoolDown, 0, ty = 'Action'],
  625.   11 => [Cmd11_Name,    c = 11,  Cmd11_IconIndex, t = 0,   tg = true, nil,
  626.          Cmd11_Description, Cmd11_CoolDown, 0, ty = 'Action'],
  627.   12 => [Cmd12_Name,    c = 12,  Cmd12_IconIndex, t = 0,   tg = true, nil,
  628.          Cmd12_Description, Cmd12_CoolDown, 0, ty = 'Action'],
  629.   13 => [Cmd13_Name,    c = 13,  Cmd13_IconIndex, t = 0,   tg = true, nil,
  630.          Cmd13_Description, Cmd13_CoolDown, 0, ty = 'Action'],
  631.   #-------------------- casting commands
  632.   14 => [Cmd14_Name,    c = 14,  Cmd14_IconIndex, t = 300,   tg = false, nil,
  633.          Cmd14_Description, Cmd14_CoolDown, 0, ty = 'Casting'],
  634.   15 => [Cmd15_Name,    c = 15,  Cmd15_IconIndex, t = 200,   tg = false, nil,
  635.          Cmd15_Description, Cmd15_CoolDown, 0, ty = 'Casting'],
  636.   16 => [Cmd16_Name,    c = 16,  Cmd16_IconIndex, t = 200,   tg = false, nil,
  637.          Cmd16_Description, Cmd16_CoolDown, 0, ty = 'Casting'],
  638.   17 => [Cmd17_Name,    c = 17,  Cmd17_IconIndex, t = 200,   tg = false, nil,
  639.          Cmd17_Description, Cmd17_CoolDown, 0, ty = 'Casting'],
  640.   18 => [Cmd18_Name,    c = 18,  Cmd18_IconIndex, t = 200,   tg = false, nil,
  641.          Cmd18_Description, Cmd18_CoolDown, 0, ty = 'Casting'],
  642.   19 => [Cmd19_Name,    c = 19,  Cmd19_IconIndex, t = 200,   tg = false, nil,
  643.          Cmd19_Description, Cmd19_CoolDown, 0, ty = 'Casting'],
  644.          
  645.   #----------------------- custom commands      
  646.   20 => [Cmd20_Name, c = 20, Cmd20_IconIndex, Cmd20_ActionTime, tg = false, nil,
  647.          Cmd20_Description, Cmd20_CoolDown, Cmd20_MoodGain, Cmd20_Type],
  648.   21 => [Cmd21_Name, c = 21, Cmd21_IconIndex, Cmd21_ActionTime, tg = false, nil,
  649.          Cmd21_Description, Cmd21_CoolDown, Cmd21_MoodGain, Cmd21_Type],
  650.   22 => [Cmd22_Name, c = 22, Cmd22_IconIndex, Cmd22_ActionTime, tg = false, nil,
  651.          Cmd22_Description, Cmd22_CoolDown, Cmd22_MoodGain, Cmd22_Type],
  652.   23 => [Cmd23_Name, c = 23, Cmd23_IconIndex, Cmd23_ActionTime, tg = false, nil,
  653.          Cmd23_Description, Cmd23_CoolDown, Cmd23_MoodGain, Cmd23_Type],
  654.   24 => [Cmd24_Name, c = 24, Cmd24_IconIndex, Cmd24_ActionTime, tg = false, nil,
  655.          Cmd24_Description, Cmd24_CoolDown, Cmd24_MoodGain, Cmd24_Type],
  656.   25 => [Cmd25_Name, c = 25, Cmd25_IconIndex, Cmd25_ActionTime, tg = false, nil,
  657.          Cmd25_Description, Cmd25_CoolDown, Cmd25_MoodGain, Cmd25_Type],
  658.   #--------------------------------------------------------------
  659.   26 => [Cmd26_Name,    c = 26,  Cmd26_IconIndex, t = 0,   tg = false, s = true,
  660.          Cmd26_Description, Cmd26_CoolDown, 0, ty = 'Listing'],
  661.          
  662.   #----this is the command return, this is not listed, it cannot be changed
  663.   27 => [nil, nil, nil, nil, nil, nil,
  664.          nil, nil, nil, nil],
  665.          
  666.   #-----------------------------------------------------------------------------
  667.   # Need more custom commands? you can create as many custom commands you need
  668.   # the next command on database would be 28, see examples below
  669.   #  28 => ['name', id, icon_index, action_time, target, nil,
  670.   #          'Description', Cool down, mood gainig, type],
  671.   #
  672.   #  So the command should be as follows
  673.   #
  674.   # 28 => ['Any name', id = 28, icon = 19, action_time = 200, false, nil,
  675.   #        'Any description', cooldown = 5, mood_gain = 0, type = 'Any type'],
  676.   #
  677.   #
  678.   # Do not change the values  "false, nil" from the commands data, they are
  679.   # defaults for the action commands.
  680.   #-----------------------------------------------------------------------------
  681.   # * Start creating new custom commands here
  682.  
  683.  
  684.  
  685.   }
  686.  
  687. end
  688.  
  689.  
  690. #-------------------------------------------------------------------------------
  691. # Game Pet class
  692.  
  693. class Game_Pet < Game_Character
  694.   include FalPet
  695.   attr_accessor :command, :stucked, :lastspot, :action_time, :short_jump
  696.   attr_accessor :chase_event_id, :mood, :cooldown, :unlock_command,:reservedmood
  697.   attr_accessor :pet_level, :grow_inflation, :lvup_pop, :stealed_item, :pet_id
  698.   attr_accessor :character_name, :character_index, :petname, :sounds, :casting
  699.   attr_accessor :randomitem, :custom_mode, :stuck_count, :instantcd, :through
  700.   def initialize
  701.     super
  702.     @pet_id = 0
  703.     @priority_type = 1
  704.     @mood = 0
  705.     @pet_level = 1
  706.     @cooldown = []
  707.     FalPet::Commands.keys.size.times do ; @cooldown.push(0) ; end
  708.     @unlock_command = DeafaultMoodCommands
  709.     @grow_inflation = [StartingMoodMax, grow = 0, GiftBundle.max_by{|k,v| v}[0]]
  710.     @lvup_pop = false
  711.     @instantcd = 0
  712.     reset_pet
  713.   end
  714.  
  715.   def reset_pet
  716.     @command = 0
  717.     @stucked = 0
  718.     @action_time = 0
  719.     @short_jump = false
  720.     @lastspot = nil
  721.     @casting = false
  722.     @custom_mode = nil
  723.     @stuck_count = 0
  724.     @through = true
  725.     $game_switches[CustomSwitch] = false if $game_switches[CustomSwitch]
  726.   end
  727.  
  728.   # set up
  729.   def setup_pet(id)
  730.     get_bonus(@pet_id, sub = true) if @pet_id > 0
  731.     @pet_id = id
  732.     set = Pets[@pet_id]
  733.     @character_name = set[0]
  734.     @character_index = set[1]
  735.     @petname = set[2]
  736.     @sounds = [set[3], set[4], set[5]]
  737.     @balloon_id = 1 if SceneManager.scene_is?(Scene_Map)
  738.     play_voice
  739.     get_bonus(@pet_id)
  740.   end
  741.  
  742.   def get_bonus(id, sub=false)
  743.     set = Bonus[id]
  744.     for member in $game_party.members
  745.       for i in 0...8
  746.         sub ? member.add_param(i, -set[i]) : member.add_param(i, set[i])
  747.       end
  748.     end
  749.   end
  750.  
  751.   def play_voice
  752.     RPG::SE.new(@sounds[0],@sounds[1],@sounds[2]).play
  753.   end
  754.  
  755.   def busy?
  756.     @command > 0
  757.   end
  758.  
  759.   def custom_command?
  760.     return true if @command.between?(20, 25)
  761.     return true if @command.between?(28, FalPet::Commands.keys.size)
  762.     return false
  763.   end
  764.  
  765.   def time?(t)
  766.     t == @action_time
  767.   end
  768.  
  769.   def prepare
  770.     $game_player.prepare_petact
  771.   end
  772.  
  773.   def pop_text(text, time)
  774.     $game_player.gamepet.custom_mode = text
  775.     $game_player.petpop_time = time * 60
  776.   end
  777.  
  778.   def pop_mood
  779.     $game_player.start_poping_window(1, 3)
  780.   end
  781.  
  782.   def level
  783.     return @pet_level
  784.   end
  785.  
  786.   def cast
  787.     @casting = true
  788.   end
  789.  
  790.   def ending?
  791.     @action_time == 2
  792.   end
  793.  
  794.   def cmd?(c)
  795.     c == @command
  796.   end
  797.  
  798.   def play_balloon
  799.     @balloon_id = BalloonPlaying
  800.   end
  801.  
  802.   def zoom(x, y)
  803.     @zoomfx_x = x
  804.     @zoomfx_y = y
  805.   end
  806.  
  807.   def reset_zoom
  808.     @zoomfx_x = 1.0
  809.     @zoomfx_y = 1.0
  810.   end
  811.  
  812.   def gain_mood(n)
  813.     @mood = [[@mood + n, 0].max, @grow_inflation[0]].min
  814.   end
  815.  
  816.   def gain_level(n)
  817.     @pet_level = [[@pet_level + n, 0].max, @grow_inflation[2]].min
  818.   end
  819.  
  820.   def mood_full?
  821.     @mood == @grow_inflation[0]
  822.   end
  823.  
  824.   # apply pet growing
  825.   def apply_growing
  826.     @grow_inflation[1] += 1
  827.     if @grow_inflation[1] == Growing
  828.       if @pet_level != @grow_inflation[2]
  829.         @grow_inflation[0] = @grow_inflation[0] + MoodMaxPlus
  830.         gain_level(1)
  831.         @lvup_pop = true
  832.       end
  833.       @grow_inflation[1] = 0
  834.     end
  835.   end
  836.  
  837.   def twist(value, m)
  838.     set_direction(2) if @action_time == value
  839.     set_direction(4) if @action_time == value - m
  840.     set_direction(6) if @action_time == value - m - m
  841.     set_direction(8) if @action_time == value - m - m - m
  842.   end
  843.  
  844.   def mood_cmd(id)
  845.     return unless id.between?(2, 9)
  846.     @unlock_command.push(id) unless @unlock_command.include?(id)
  847.   end
  848.  
  849.   # gift item
  850.   def mood_item
  851.     FalPet::GiftBundle.each do |level, item_id|
  852.       if level == @pet_level
  853.         item = $data_items[item_id]
  854.         return item if !item.nil?
  855.       end
  856.     end
  857.     return $data_items[1]
  858.   end
  859.  
  860.   # radom items
  861.   def get_randomitem(type, variable)
  862.     case type
  863.     when 'item'   ; operand = $data_items
  864.     when 'weapon' ; operand = $data_weapons
  865.     when 'armor'  ; operand = $data_armors
  866.     when 'gold'   ; operand = nil
  867.     end
  868.     if operand != nil
  869.       data = []
  870.       variable.each {|id, value|  data.push([id, value])}
  871.       item = data[rand(data.size)]
  872.       @randomitem = [operand[item[0]], item[1]]
  873.     else
  874.       gold = variable[rand(variable.size)]
  875.       @randomitem = [gold]
  876.     end
  877.   end
  878.  
  879.   def update
  880.     @pattern = 0 if @casting
  881.     @move_speed = $game_player.real_move_speed if !busy?
  882.     if custom_command?
  883.       $game_switches[CustomSwitch] = true if !$game_switches[CustomSwitch]
  884.     end
  885.     for event in $game_map.events.values
  886.       if event.check_evcom("/PET GRAB")
  887.         event.priority_type = 1 if event.priority_type != 1
  888.       end
  889.     end
  890.     super
  891.   end
  892.  
  893.   def cast_item_producing(anime, ct=false)
  894.     case @action_time
  895.     when 180 ; jump_high(0, 0, 16) ; @casting = true
  896.     when 160 ; ct ? $game_player.animation_id = anime : @animation_id = anime
  897.     when 6   ; play_balloon ; play_voice
  898.     when 1   ; RPG::SE.new("Item3",80).play if !ct
  899.     ct ? $game_player.start_poping_window(13, 2) :
  900.     $game_player.start_poping_window(11, 3)
  901.     end
  902.   end
  903.  
  904.   def update_anime_pattern
  905.     @casting ? return : super
  906.   end
  907. end
  908.  
  909. #-------------------------------------------------------------------------------
  910. # * Character base new methods and variabbles
  911.  
  912. class Game_CharacterBase
  913.   attr_accessor :x, :y, :direction, :priority_type, :pattern, :through
  914.   attr_accessor :step_anime, :direction_fix, :move_speed, :egrabbing
  915.   attr_accessor :zoomfx_x
  916.   attr_accessor :zoomfx_y
  917.   attr_accessor :anglefx
  918.  
  919.   alias falcao_zoomfx_ini initialize
  920.   def initialize
  921.     @zoomfx_x = 1.0
  922.     @zoomfx_y = 1.0
  923.     @anglefx = 0.0
  924.     @layingdown = false
  925.     falcao_zoomfx_ini
  926.   end
  927.  
  928.   def liedown
  929.     set_direction(8)
  930.     @anglefx = 100
  931.     @layingdown = true
  932.   end
  933.  
  934.   def reset_liedown
  935.     @anglefx = 0.0
  936.     @layingdown = false
  937.   end
  938.  
  939.   def move_toward_char(character)
  940.     sx = distance_x_from(character.x)
  941.     sy = distance_y_from(character.y)
  942.     if sx != 0 && sy != 0
  943.       move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  944.     elsif sx != 0
  945.       move_straight(sx > 0 ? 4 : 6)
  946.     elsif sy != 0
  947.       move_straight(sy > 0 ? 8 : 2)
  948.     end
  949.   end
  950.  
  951.   # jump to specific tiles
  952.   def jumpto_tile(x, y)
  953.     jumpto(0, [x, y])
  954.   end
  955.  
  956.   # jumpto character ( 0 = Game Player, 1 and up event id)
  957.   def jumpto(char_id, tilexy=nil)
  958.     char_id > 0 ? char = $game_map.events[char_id] : char = $game_player
  959.     tilexy.nil? ? condxy = [char.x, char.y] : condxy = [tilexy[0], tilexy[1]]
  960.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  961.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  962.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  963.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  964.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  965.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  966.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  967.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  968.     jump(jx, jy)
  969.   end
  970.  
  971.   def eval_distance(target)
  972.     if target.is_a?(Array)
  973.       distance_x = (@x - target[0]).abs
  974.       distance_y = (@y - target[1]).abs
  975.     else
  976.       distance_x = (@x - target.x).abs
  977.       distance_y = (@y - target.y).abs
  978.     end
  979.     return [distance_x, distance_y]
  980.   end
  981.  
  982.   # climb area
  983.   def climb_area?(target, size)
  984.     distance = (@x - target.x).abs + (@y - target.y).abs
  985.     enable   = (distance <= size-1)
  986.     return true if enable
  987.     return false
  988.   end
  989.  
  990.   # controlled jump x, y , height
  991.   def jump_high(x_plus, y_plus, heigh)
  992.     if x_plus.abs > y_plus.abs
  993.       set_direction(x_plus < 0 ? 4 : 6) if x_plus != 0
  994.     else
  995.       set_direction(y_plus < 0 ? 8 : 2) if y_plus != 0
  996.     end
  997.     @x += x_plus
  998.     @y += y_plus
  999.     distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1000.     @jump_peak = heigh + distance - @move_speed
  1001.     @jump_count = @jump_peak * 2
  1002.     @stop_count = 0
  1003.     straighten ; @priority_type = 2
  1004.   end
  1005.  
  1006.   def samepos?(target)
  1007.     @x == target.x and @y == target.y
  1008.   end
  1009.  
  1010.   # get distance passable tile_x and tile_y
  1011.   def tiles_pass
  1012.     dir = @direction
  1013.     operand = 17 if dir == 4 || dir == 6
  1014.     operand = 13 if dir == 2 || dir == 8
  1015.     for i in 1...operand
  1016.       return [@x, @y + i] if dir == 2 and $game_map.passable?(@x, @y + i, dir)
  1017.       return [@x, @y - i] if dir == 8 and $game_map.passable?(@x, @y - i, dir)
  1018.       return [@x - i, @y] if dir == 4 and $game_map.passable?(@x - i, @y, dir)  
  1019.       return [@x + i, @y] if dir == 6 and $game_map.passable?(@x + i, @y, dir)  
  1020.     end
  1021.     return nil
  1022.   end
  1023.  
  1024.   def adjustpxy
  1025.     push_x, push_y =   0,   1 if @direction == 2
  1026.     push_x, push_y = - 1,   0 if @direction == 4
  1027.     push_x, push_y =   1,   0 if @direction == 6
  1028.     push_x, push_y =   0, - 1 if @direction == 8
  1029.     return [push_x, push_y]
  1030.   end
  1031.  
  1032. end
  1033.  
  1034. #-------------------------------------------------------------------------------
  1035. # * Game player new methods and variabbles
  1036.  
  1037. class Game_Player < Game_Character
  1038.   attr_reader   :gamepet
  1039.   attr_reader   :showing_pet
  1040.   attr_accessor :petpop_time
  1041.   attr_accessor :petpop_refresh
  1042.   attr_accessor :petpop_type
  1043.   attr_accessor :adopted_pets
  1044.   attr_accessor :just_jumped
  1045.   alias falcao_pet_ini initialize
  1046.   def initialize
  1047.     @gamepet = Game_Pet.new
  1048.     @showing_pet = false
  1049.     @petpop_refresh = false
  1050.     @petpop_time = 0
  1051.     @petpop_type = 0
  1052.     @climb_wait = 0
  1053.     @adopted_pets = []
  1054.     @just_jumped = false
  1055.     falcao_pet_ini
  1056.   end
  1057.  
  1058.   alias falcao_pet_main_update update
  1059.   def update
  1060.     update_gamepet
  1061.     falcao_pet_main_update
  1062.   end
  1063.  
  1064.   def adopt_pet(id)
  1065.     @adopted_pets.include?(id) ? return :  @adopted_pets.push(id)
  1066.     @gamepet.setup_pet(id)
  1067.     @showing_pet = true
  1068.   end
  1069.  
  1070.   def have_pet?
  1071.     !@adopted_pets.empty?
  1072.   end
  1073.  
  1074.   def update_gamepet
  1075.     return unless have_pet?
  1076.    
  1077.     if @gamepet.action_time > 0
  1078.       @gamepet.action_time -= 1
  1079.       globalpet_reset if @gamepet.action_time == 0
  1080.     end
  1081.     @petpop_time -= 1 if @petpop_time > 0
  1082.     @climb_wait -= 1 if @climb_wait > 0
  1083.     @gamepet.update if @showing_pet
  1084.     update_path_manager
  1085.     update_call_commands
  1086.     case @gamepet.command
  1087.     when 1
  1088.       update_command_showhide
  1089.     when 2..9
  1090.       update_command_play
  1091.     when 10
  1092.       update_command_startevet(@gamepet.chase_event_id)
  1093.     when 11
  1094.       update_command_steal(@gamepet.chase_event_id)
  1095.     when 12
  1096.       update_command_grab(@gamepet.chase_event_id)
  1097.     when 13
  1098.       update_command_climb(@gamepet.chase_event_id)
  1099.     when 14
  1100.       update_command_heal
  1101.     when 15
  1102.       update_command_randomitems
  1103.     when 16
  1104.       update_command_randomweapons
  1105.     when 17
  1106.       update_command_randomarmors
  1107.     when 18
  1108.       update_command_randomgold
  1109.     when 19
  1110.       update_command_instantcd
  1111.     when 27
  1112.       update_command_return
  1113.     end
  1114.     update_poppetwindow
  1115.   end
  1116.  
  1117.   def update_call_commands
  1118.     return unless FalPet::UseKey
  1119.     SceneManager.call(Scene_PetCommands) if Input.trigger?(FalPet::CommandsKey)
  1120.   end
  1121.  
  1122.   # command return
  1123.   def update_command_return
  1124.     @gamepet.move_toward_character(self) unless @gamepet.moving?
  1125.     globalpet_reset if @gamepet.x == @x and @gamepet.y == @y
  1126.   end
  1127.  
  1128.   # path manager
  1129.   def update_path_manager
  1130.     return unless @gamepet.command == 27 || @gamepet.command.between?(10, 13)
  1131.     @gamepet.stucked += 1 if not @gamepet.moving?
  1132.     @gamepet.stucked = 0 if @gamepet.moving?
  1133.     @gamepet.stucked = 0 if @climb_wait > 0 and !@gamepet.moving?
  1134.     if @gamepet.stuck_count >= FalPet::StuckCount
  1135.       @gamepet.command = 27
  1136.       @gamepet.stuck_count = 0
  1137.       start_poping_window(12, 3)
  1138.     end
  1139.     #------------------------------------------
  1140.     if @gamepet.stucked == 45
  1141.       if @gamepet.command == 27
  1142.         event = $game_map.events[@gamepet.chase_event_id] rescue nil
  1143.         @gamepet.turn_toward_character(self)
  1144.         if @gamepet.tiles_pass != nil
  1145.           tilex, tiley = @gamepet.tiles_pass[0], @gamepet.tiles_pass[1]
  1146.           @gamepet.jumpto_tile(tilex, tiley)
  1147.           event.jumpto_tile(tilex,tiley) if !event.nil? && !event.egrabbing.nil?
  1148.         else
  1149.           @gamepet.jumpto(0)
  1150.           event.jumpto(0) if !event.nil? and !event.egrabbing.nil?
  1151.         end
  1152.      
  1153.         # command activate / steal / grab / climb
  1154.       elsif @gamepet.command.between?(10, 13)
  1155.         event = $game_map.events[@gamepet.chase_event_id]
  1156.         @gamepet.turn_toward_character(event)
  1157.         if @gamepet.tiles_pass != nil
  1158.           if @gamepet.climb_area?(event, 3)
  1159.             @gamepet.jumpto(@gamepet.chase_event_id)
  1160.             return
  1161.           end
  1162.           @gamepet.jumpto_tile(@gamepet.tiles_pass[0], @gamepet.tiles_pass[1])
  1163.         else
  1164.           @gamepet.jumpto(@gamepet.chase_event_id)
  1165.         end
  1166.       end
  1167.       @gamepet.stucked = 0
  1168.       @gamepet.stuck_count += 1
  1169.     end
  1170.   end
  1171.  
  1172.   def start_poping_window(type, time, seconds=true)
  1173.     @petpop_type = type
  1174.     seconds ? @petpop_time = time * 60 : @petpop_time = time
  1175.   end
  1176.  
  1177.   # comand showhide
  1178.   def update_command_showhide
  1179.     # hide
  1180.     if @showing_pet
  1181.       @gamepet.balloon_id = 1
  1182.       unless @gamepet.jumping?
  1183.         @showing_pet = false
  1184.         @gamepet.reset_pet
  1185.       end
  1186.       # show
  1187.     else
  1188.       @gamepet.balloon_id = 4
  1189.       @showing_pet = true
  1190.       @gamepet.reset_pet
  1191.     end
  1192.   end
  1193.  
  1194.   # play with pet
  1195.   def update_command_play
  1196.     prepare_petact
  1197.     time = @gamepet.action_time
  1198.     case @gamepet.command
  1199.     when 2 # jump jump
  1200.       @gamepet.jump(0,0) if time == 130
  1201.       @gamepet.jump(0,0) if time == 100
  1202.       @gamepet.jump(0,0) if time == 70
  1203.       @gamepet.play_balloon if time == 40
  1204.       @gamepet.play_voice  if time == 20
  1205.      
  1206.     when 3 # tun r around
  1207.       @gamepet.jump(0,0) if time == 130
  1208.       @gamepet.twist(100, 10)
  1209.       @gamepet.turn_toward_character(self) if time == 50
  1210.       @gamepet.play_balloon if time == 30
  1211.       @gamepet.play_voice if time == 20
  1212.      
  1213.     when 4 # zoom
  1214.       if time > 90 and time < 130
  1215.         @gamepet.zoomfx_x += 0.02
  1216.         @gamepet.zoomfx_y += 0.02
  1217.       elsif time > 30 and time < 70
  1218.         @gamepet.zoomfx_x -= 0.02
  1219.         @gamepet.zoomfx_y -= 0.02
  1220.       end
  1221.       @gamepet.play_balloon if time == 30
  1222.       @gamepet.play_voice if time == 20
  1223.      
  1224.     when 5 #chase jump
  1225.       if time == 130
  1226.         @gamepet.lastspot = [@gamepet.x, @gamepet.y]
  1227.         @gamepet.jumpto(0)
  1228.       elsif time == 90
  1229.         @gamepet.jumpto_tile(@gamepet.lastspot[0], @gamepet.lastspot[1])
  1230.       end
  1231.       @gamepet.move_forward if time == 70
  1232.       @gamepet.turn_toward_character(self) if time == 50
  1233.       @gamepet.move_forward if time == 10
  1234.       @gamepet.play_balloon if time == 30
  1235.       @gamepet.play_voice if time == 20
  1236.      
  1237.     when 6 # twist
  1238.       @gamepet.move_away_from_player if time == 170
  1239.       @gamepet.turn_toward_character(self) if time == 150
  1240.       @gamepet.twist(140, 5) ; @gamepet.twist(120, 5)
  1241.       @gamepet.twist(100, 5) ; @gamepet.twist(80, 5)
  1242.       @gamepet.twist(60, 5)  ; @gamepet.twist(40, 10)
  1243.       @gamepet.play_balloon if time == 20
  1244.       @gamepet.play_voice if time == 10
  1245.       @gamepet.jump(0,0) if time == 10
  1246.       @gamepet.turn_toward_character(self) if time == 10
  1247.      
  1248.     when 7 # play dead
  1249.       @gamepet.move_away_from_player if time == 470
  1250.       @gamepet.turn_toward_character(self) if time == 450
  1251.       @gamepet.balloon_id = FalPet::PlayDeadBalloon if  time == 400
  1252.       @gamepet.liedown if time == 430
  1253.       @gamepet.play_balloon if time == 20
  1254.       @gamepet.play_voice if time == 10
  1255.       @gamepet.turn_toward_character(self) if time == 10
  1256.      
  1257.     when 8 # dance
  1258.       RPG::BGM.fade(1 * 1000) if time == 590
  1259.       @gamepet.move_away_from_player if time == 470
  1260.       @gamepet.turn_toward_character(self) if time == 450
  1261.       if time == 410
  1262.         $game_system.save_bgm
  1263.         RPG::BGM.new(FalPet::DancingBgm,80).play
  1264.         @gamepet.step_anime = true
  1265.         @gamepet.move_speed = 5
  1266.       end
  1267.       @gamepet.move_forward if time == 320
  1268.       @gamepet.move_backward if time == 260
  1269.       @gamepet.jump(0, 0) if time == 220
  1270.       @gamepet.jump(0, 0) if time == 205
  1271.       @gamepet.twist(180, 5) ; @gamepet.twist(160, 5)
  1272.       @gamepet.turn_toward_character(self) if time == 130
  1273.       @gamepet.move_speed = 4 if time == 125
  1274.       @gamepet.liedown if time == 120
  1275.       @gamepet.reset_liedown if time == 110
  1276.       @gamepet.play_balloon if time == 40
  1277.       @gamepet.play_voice if time == 40
  1278.       @gamepet.move_toward_player if time == 30
  1279.       $game_system.replay_bgm if time == 2
  1280.      
  1281.     when 9 # trampoline
  1282.       case time
  1283.       when 350; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1284.       when 300; jump_high(0, 0, 20); ; RPG::SE.new("Jump2",80,).play
  1285.       when 250; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1286.       when 200; jump_high(0, 0, 20); ; RPG::SE.new("Jump2",80,).play
  1287.       when 150; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1288.       when 112; @gamepet.liedown; RPG::SE.new("Crossbow",80,).play
  1289.                 $game_map.screen.start_shake(7, 7, 20)
  1290.       when 80;  @gamepet.play_balloon; RPG::SE.new("Miss",80,).play
  1291.       when 10;  @gamepet.reset_liedown; @gamepet.play_voice
  1292.                 @gamepet.turn_toward_player
  1293.       end
  1294.     end
  1295.     start_poping_window(1, 3) if time == 1
  1296.   end
  1297.  
  1298.   # reseting
  1299.   def globalpet_reset
  1300.     @gamepet.reset_pet
  1301.     @gamepet.zoomfx_x = 1.0
  1302.     @gamepet.zoomfx_y = 1.0
  1303.     @gamepet.reset_liedown
  1304.     @vastored = nil
  1305.     @gamepet.step_anime = false
  1306.     @gamepet.direction_fix = false
  1307.     @gamepet.priority_type = 1
  1308.     @climb_wait = 0
  1309.     if @gamepet.chase_event_id != nil
  1310.       event = $game_map.events[@gamepet.chase_event_id]
  1311.       if !event.nil? and !event.egrabbing.nil?
  1312.         event.egrabbing = nil
  1313.         event.move_speed = @gvdata[0]
  1314.         event.move_type = @gvdata[1]
  1315.         event.priority_type = @gvdata[2]
  1316.       end
  1317.     end
  1318.   end
  1319.  
  1320.   def update_poppetwindow
  1321.     if @gamepet.lvup_pop and @petpop_time == 0
  1322.       start_poping_window(3, 80, false)
  1323.       @petpop_refresh = true
  1324.       @gamepet.lvup_pop = false
  1325.       RPG::SE.new("Up1",80).play
  1326.       @gamepet.jump(0, 0)
  1327.     end
  1328.     if @petpop_time == 2 * 60 and @petpop_type == 1 and
  1329.       @gamepet.reservedmood != 0
  1330.       @gamepet.gain_mood(@gamepet.reservedmood)
  1331.       @gamepet.mood_full? ? @petpop_type = 2 : @petpop_type = 1
  1332.       @petpop_refresh = true
  1333.       @reservedmood = 0
  1334.     end
  1335.   end
  1336.  
  1337. #-------------------------------------------------------------------------------
  1338. # Pet trigger targets
  1339.   def update_command_startevet(id)
  1340.     event = $game_map.events[id]
  1341.     @gamepet.through = false if @gamepet.through
  1342.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1343.     if @gamepet.samepos?(event) && @gamepet.command == 10 && !@gamepet.jumping?
  1344.       event.check_evcom("/PET TRIGGER") ? event.start : start_poping_window(4,2)
  1345.       @gamepet.command = 27
  1346.     end
  1347.   end
  1348.  
  1349.   #-----------------------------------------------------------------------------
  1350.   # steal
  1351.  
  1352.   def update_command_steal(id)
  1353.     event = $game_map.events[id]
  1354.     @gamepet.through = false if @gamepet.through
  1355.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1356.     if @gamepet.samepos?(event) && @gamepet.command == 11 && !@gamepet.jumping?
  1357.       item   = event.check_evvar("/PET STEAL ITEM")
  1358.       weapon = event.check_evvar("/PET STEAL WEAPON")
  1359.       armor  = event.check_evvar("/PET STEAL ARMOR")
  1360.       gold   = event.check_evvar("/PET STEAL GOLD")
  1361.       chance = event.check_evvar("/PET STEAL CHANCE 1 / ")
  1362.       chance = 1 if chance == 0
  1363.       have_something = item > 0 || weapon > 0 || gold > 0 || armor > 0
  1364.       unless have_something
  1365.         start_poping_window(7, 3)
  1366.         @gamepet.play_voice
  1367.         @gamepet.command = 27
  1368.         return
  1369.       end
  1370.       if rand(chance) == 0
  1371.         if item != 0
  1372.           gain_stealed_item($data_items[item])
  1373.         elsif weapon != 0
  1374.           gain_stealed_item($data_weapons[weapon])
  1375.         elsif armor != 0
  1376.           gain_stealed_item($data_armors[armor])
  1377.         elsif gold != 0
  1378.           @gamepet.stealed_item = gold
  1379.           $game_party.gain_gold(gold)
  1380.           RPG::SE.new("Shop",80).play
  1381.           start_poping_window(5, 3)
  1382.         end
  1383.       else
  1384.         start_poping_window(6, 3)
  1385.         @gamepet.play_voice
  1386.       end
  1387.       @gamepet.command = 27
  1388.     end
  1389.   end
  1390.  
  1391.   def gain_stealed_item(stealed)
  1392.     @gamepet.stealed_item = stealed
  1393.     $game_party.gain_item(stealed, 1)
  1394.     RPG::SE.new("Item3",80).play
  1395.     start_poping_window(5, 3)
  1396.   end
  1397.  
  1398.   #-----------------------------------------------------------------------------
  1399.   # Grab
  1400.  
  1401.   def update_command_grab(id)
  1402.     event = $game_map.events[id]
  1403.     @gamepet.through = false if @gamepet.through
  1404.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1405.     if @gamepet.samepos?(event) && @gamepet.command == 12 && !@gamepet.jumping?
  1406.       @gvdata = [event.move_speed, event.move_type, event.priority_type]
  1407.       event.check_evcom("/PET GRAB") ? event.egrabbing = true :
  1408.       start_poping_window(8, 2)
  1409.       @gamepet.command = 27
  1410.     end
  1411.   end
  1412.  
  1413.   #-----------------------------------------------------------------------------
  1414.   # Climb CLIMB MIERDDAAAAAAAAAAAAAAAAAAAA
  1415.  
  1416.   def update_command_climb(id)
  1417.     event = $game_map.events[id]
  1418.     event.priority_type = 0 if event.priority_type != 0
  1419.     event.through = true if !event.through
  1420.     @gamepet.through = false if @gamepet.through
  1421.     @gamepet.move_toward_character(event) if !@gamepet.moving? and
  1422.     @climb_wait == 0
  1423.     @gamepet.turn_toward_character(self) if @climb_wait > 0
  1424.     if @climb_wait == 1 and @gamepet.x == event.x and @gamepet.y == event.y
  1425.       @gamepet.command = 27
  1426.       return
  1427.     end
  1428.     if climb_area?(event, 7) and @climb_wait > 0 and !moving?
  1429.       if @gamepet.x == @x and @gamepet.y == @y
  1430.         globalpet_reset
  1431.         return
  1432.       end
  1433.       # jump to cimb aerea player
  1434.       if !passable?(@x, @y, @direction) and @gamepet.x == event.x and
  1435.         @gamepet.y == event.y and Input.dir8 != 0
  1436.         jumpto(event.id)
  1437.         self.followers.reverse_each do |f|
  1438.           f.move_toward_player ; f.move_toward_player ; f.move_toward_player
  1439.           f.jumpto(event.id)
  1440.         end
  1441.         RPG::SE.new("Shot1",80).play
  1442.         globalpet_reset
  1443.       end
  1444.     end
  1445.     if @gamepet.samepos?(event) && @climb_wait == 0 && !@gamepet.jumping?
  1446.       if event.check_evcom("/PET CLIMB")
  1447.         unless @gamepet.x == @x and @gamepet.y == @y
  1448.           start_poping_window(9, 1)
  1449.           @gamepet.play_voice
  1450.           @gamepet.jump(0, 0)
  1451.           @climb_wait = 12 * 60
  1452.         end
  1453.       end
  1454.     end
  1455.   end
  1456.  
  1457.   # preparation for pet acting
  1458.   def prepare_petact
  1459.     if @vastored.nil?
  1460.       turn_toward_character(@gamepet) ; @gamepet.turn_toward_character(self)
  1461.       @vastored = true ; followers.gather
  1462.     end
  1463.   end
  1464.  
  1465.   #-----------------------------------------------------------------------------
  1466.   # heal command
  1467.  
  1468.   def update_command_heal
  1469.     prepare_petact
  1470.     @gamepet.move_away_from_player if @gamepet.action_time == 270
  1471.     @gamepet.turn_toward_character(self) if @gamepet.action_time == 250
  1472.     if @gamepet.action_time == 210
  1473.       @gamepet.jump_high(0, 0, 18)
  1474.       @gamepet.casting = true
  1475.     end
  1476.     $game_map.screen.start_shake(5, 5, 60) if @gamepet.action_time == 160
  1477.     if @gamepet.action_time == 120
  1478.       @gamepet.balloon_id = 1
  1479.       @gamepet.play_voice
  1480.     end
  1481.     self.animation_id = 40 if @gamepet.action_time == 100
  1482.     if @gamepet.action_time == 1
  1483.       for member in $game_party.members
  1484.         case FalPet::HealPercent
  1485.         when '25%'  ; hp = 4    ; when '50%'  ; hp = 2
  1486.         when '75%'  ; hp = 1.32 ; when '100%' ; hp = 1
  1487.         end
  1488.         member.change_hp((member.mhp  / hp).truncate, false)
  1489.         member.mp += (member.mmp  / hp).truncate
  1490.         start_poping_window(10, 3)
  1491.       end
  1492.     end
  1493.   end
  1494.  
  1495.   #-----------------------------------------------------------------------------
  1496.   # Make random item
  1497.   def update_command_randomitems
  1498.     prepare_petact
  1499.     @gamepet.cast_item_producing(FalPet::ItemAnime)
  1500.     if @gamepet.action_time == 2
  1501.       @gamepet.get_randomitem('item', FalPet::RandomItems)
  1502.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1503.     end
  1504.   end
  1505.  
  1506.   #-----------------------------------------------------------------------------
  1507.   # Make random weapon
  1508.   def update_command_randomweapons
  1509.     prepare_petact
  1510.     @gamepet.cast_item_producing(FalPet::WeaponAnime)
  1511.     if @gamepet.action_time == 2
  1512.       @gamepet.get_randomitem('weapon', FalPet::RandomWeapons)
  1513.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1514.     end
  1515.   end
  1516.  
  1517.   #-----------------------------------------------------------------------------
  1518.   # Make random armor
  1519.   def update_command_randomarmors
  1520.     prepare_petact
  1521.     @gamepet.cast_item_producing(FalPet::ArmorAnime)
  1522.     if @gamepet.action_time == 2
  1523.       @gamepet.get_randomitem('armor', FalPet::RandomArmors)
  1524.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1525.     end
  1526.   end
  1527.  
  1528.   #-----------------------------------------------------------------------------
  1529.   # Make random gold
  1530.   def update_command_randomgold
  1531.     prepare_petact
  1532.     @gamepet.cast_item_producing(FalPet::GoldAnime)
  1533.     if @gamepet.action_time == 2
  1534.       @gamepet.get_randomitem('gold', FalPet::RandomGold)
  1535.       $game_party.gain_gold(@gamepet.randomitem[0])
  1536.       RPG::SE.new("Shop",80).play
  1537.     end
  1538.   end
  1539.  
  1540.   #-----------------------------------------------------------------------------
  1541.   # Command instant cooldown
  1542.   def update_command_instantcd
  1543.     prepare_petact
  1544.     @gamepet.cast_item_producing(FalPet::GoldAnime, true)
  1545.     if @gamepet.action_time == 2
  1546.       @gamepet.instantcd = FalPet::BuffDuration * 60
  1547.     end
  1548.   end
  1549.  
  1550.   #-----------------------------------------------------------------------------
  1551.   alias falcaopet_move_straight move_straight
  1552.   def move_straight(d, turn_ok = true)
  1553.     return if @layingdown
  1554.     @gamepet.move_toward_char(self) if passable?(@x, @y, d) and
  1555.     not @gamepet.busy?
  1556.     falcaopet_move_straight(d, turn_ok = true)
  1557.     @just_jumped = false if @just_jumped
  1558.   end
  1559.  
  1560.   alias falcaopet_move_diagonal move_diagonal
  1561.   def move_diagonal(horz, vert)
  1562.     @gamepet.move_toward_char(self) if diagonal_passable?(@x,@y, horz, vert) and
  1563.     not @gamepet.busy?
  1564.     falcaopet_move_diagonal(horz, vert)
  1565.   end
  1566.  
  1567.   alias falcaopet_perform_transfer perform_transfer
  1568.   def perform_transfer
  1569.     $game_system.replay_bgm if @gamepet.command == 8
  1570.     globalpet_reset
  1571.     falcaopet_perform_transfer
  1572.     @gamepet.moveto(@x, @y)
  1573.     @gamepet.set_direction(@direction)
  1574.   end
  1575.  
  1576.   alias falcaopet_get_on_vehicle get_on_vehicle
  1577.   def get_on_vehicle
  1578.     falcaopet_get_on_vehicle
  1579.     if vehicle
  1580.       @showing_pet = false
  1581.       $game_system.replay_bgm if @gamepet.command == 8 ; globalpet_reset
  1582.     end
  1583.   end
  1584. end
  1585.  
  1586. # sprite set
  1587. class Spriteset_Map
  1588.   alias falcao_pet_create_characters create_characters
  1589.   def create_characters
  1590.     create_pet_sprite
  1591.     falcao_pet_create_characters
  1592.   end
  1593.  
  1594.   alias falcao_pet_dispose dispose
  1595.   def dispose
  1596.     dispose_pet_sprite
  1597.     dispose_petpop_window
  1598.     falcao_pet_dispose
  1599.   end
  1600.  
  1601.   def create_petpop_window
  1602.     return if not @mood_window.nil?
  1603.     @mood_window = Window_Base.new(544 / 2 - 230 / 2, 0, 230, 76)
  1604.     refresh_petpop_window
  1605.   end
  1606.  
  1607.   # refresh pet pop
  1608.   def refresh_petpop_window
  1609.     return if @mood_window.nil?
  1610.     @mood_window.contents.clear
  1611.     pet = $game_player.gamepet
  1612.     if pet.custom_mode != nil
  1613.       draw_extra_text(pet.custom_mode, 0, 20)
  1614.       return
  1615.     end
  1616.     case $game_player.petpop_type
  1617.  
  1618.     # Gain mood
  1619.     when 1
  1620.       @mood_window.draw_petmoodbar(0, 38)
  1621.       case (pet.mood.to_f / pet.grow_inflation[0].to_f * 100.0)
  1622.       when  0..25  ;  text = FalPet::MoodLowText
  1623.       when 26..50  ;  text = FalPet::MoodOverageText
  1624.       when 51..75  ;  text = FalPet::MoodMediumText
  1625.       when 76..100  ; text = FalPet::MoodHight
  1626.       end
  1627.       draw_extra_text(text, 100, 5, @mood_window.normal_color)
  1628.       # Giving gift
  1629.     when 2
  1630.       @mood_window.draw_petgift(110, 20)
  1631.       draw_extra_text('Gave you a gift', 0, 20)
  1632.       return if pet.mood == 0
  1633.       $game_party.gain_item(pet.mood_item, 1)
  1634.       RPG::SE.new("Item3",80).play
  1635.       pet.mood = 0
  1636.       pet.apply_growing
  1637.      
  1638.     when 3;  draw_extra_text('Level Up!', 0, 20, Color.new(255, 120, 0, 255))
  1639.     when 4;  draw_extra_text('Cannot be triggered...', 0, 20)
  1640.     when 5;  @mood_window.draw_stealed_item(0, 20)
  1641.              @mood_window.draw_petname(0, -8)
  1642.     when 6;  draw_extra_text('Could not steal!', 0, 20)
  1643.     when 7;  draw_extra_text('Nothing to steal!', 0, 20)
  1644.     when 8;  draw_extra_text('I cannot grab this shit!', 0, 20)
  1645.     when 9;  draw_extra_text('Hey come!', 0, 20)  
  1646.     when 10
  1647.       draw_extra_text("Your party was healed by #{FalPet::HealPercent}!",0, 20)
  1648.     when 11
  1649.       item = pet.randomitem
  1650.       @mood_window.contents.fill_rect(166, -6, 30, 30, Color.new(0, 0, 0, 60))
  1651.       if item[0].is_a? Fixnum
  1652.         @mood_window.draw_icon(344, 168, 0)
  1653.         draw_extra_text("Gave you x#{item[0]} #{Vocab::currency_unit}!", 0, 20)
  1654.       else
  1655.         @mood_window.draw_icon(item[0].icon_index, 168, 0)
  1656.         draw_extra_text("Gave you #{item[0].name} x#{item[1]}!", 0, 20)
  1657.       end
  1658.     when 12; draw_extra_text('Fuck that!', 0, 20)
  1659.     when 13; draw_extra_text('Cool down become instant!', 0, 20)  
  1660.     end
  1661.   end
  1662.  
  1663.   def draw_extra_text(text, x, y, color=nil)
  1664.     @mood_window.contents.font.color = color if !color.nil?
  1665.     @mood_window.draw_petname(0, -8)
  1666.     @mood_window.contents.font.size = 18
  1667.     @mood_window.contents.draw_text(x, y, @mood_window.width, 32, text)
  1668.   end
  1669.  
  1670.   def dispose_petpop_window
  1671.     return if @mood_window.nil?
  1672.     @mood_window.dispose
  1673.     @mood_window = nil
  1674.   end
  1675.  
  1676.   alias falcao_pet_update update
  1677.   def update
  1678.     if $game_player.petpop_refresh
  1679.       refresh_petpop_window
  1680.       $game_player.petpop_refresh = false
  1681.     end
  1682.     $game_player.showing_pet ? create_pet_sprite : dispose_pet_sprite
  1683.     $game_player.petpop_time > 0 ? create_petpop_window : dispose_petpop_window
  1684.     @pet_sprite.update unless @pet_sprite.nil?
  1685.     falcao_pet_update
  1686.   end
  1687.  
  1688.   def create_pet_sprite
  1689.     return if not @pet_sprite.nil?
  1690.     @pet_sprite = Sprite_Character.new(@viewport1, $game_player.gamepet)
  1691.   end
  1692.  
  1693.   def dispose_pet_sprite
  1694.     return if @pet_sprite.nil?
  1695.     @pet_sprite.dispose
  1696.     @pet_sprite = nil
  1697.   end
  1698. end
  1699.  
  1700. class Game_Event < Game_Character
  1701.   attr_accessor  :move_type
  1702.   attr_accessor  :target_index
  1703.   def check_evcom(comment)
  1704.     return false if @list.nil? or @list.size <= 0
  1705.     for item in @list
  1706.       if item.code == 108 or item.code == 408
  1707.         if item.parameters[0].include?(comment)
  1708.           return true
  1709.         end
  1710.       end
  1711.     end
  1712.     return false
  1713.   end
  1714.  
  1715.   def check_evvar(comment)
  1716.     return 0 if @list.nil? or @list.size <= 0
  1717.     for item in @list
  1718.       if item.code == 108 or item.code == 408
  1719.         if item.parameters[0] =~ /#{comment}[ ]?(\d+)?/
  1720.           return $1.to_i
  1721.         end
  1722.       end
  1723.     end
  1724.     return 0
  1725.   end
  1726.  
  1727.   def on_current_screen?
  1728.     px = ($game_map.display_x).truncate
  1729.     py = ($game_map.display_y).truncate
  1730.     distance_x = @x - px
  1731.     distance_y = @y - py
  1732.     return true if distance_x.between?(0, 16) and distance_y.between?(0, 12)
  1733.     return false
  1734.   end
  1735. end
  1736.  
  1737. # data manager
  1738. class << DataManager
  1739.   alias falcaopet_setup_new_game setup_new_game unless $@
  1740.   def setup_new_game
  1741.     falcaopet_setup_new_game
  1742.     $game_player.gamepet.moveto($data_system.start_x, $data_system.start_y)
  1743.   end
  1744. end
  1745.  
  1746. # Sprite character
  1747. class Sprite_Character < Sprite_Base
  1748.   alias falcaopet_zoom_update update
  1749.   def update
  1750.     self.zoom_x = @character.zoomfx_x
  1751.     self.zoom_y = @character.zoomfx_y
  1752.     self.angle = @character.anglefx
  1753.     falcaopet_zoom_update
  1754.   end
  1755.  
  1756.   alias falcaopet_update_pos update_position
  1757.   def update_position
  1758.     falcaopet_update_pos
  1759.     if @character.egrabbing
  1760.       self.x = $game_player.gamepet.screen_x
  1761.       self.y = $game_player.gamepet.screen_y - 14
  1762.       @character.x = $game_player.gamepet.x
  1763.       @character.y = $game_player.gamepet.y
  1764.       @character.set_direction($game_player.gamepet.direction) unless
  1765.       @character.direction_fix
  1766.       @character.move_speed = 6
  1767.       @character.move_type = 0
  1768.       @character.priority_type = 1
  1769.     end
  1770.   end
  1771. end
  1772.  
  1773. # get custom command data
  1774. class Game_Interpreter
  1775.   def pet
  1776.     return $game_player.gamepet
  1777.   end
  1778. end
  1779.  
  1780. # Game followers plugin, this fit the pet with followers members
  1781. class Game_Follower < Game_Character
  1782.   def chase_preceding_character
  1783.     unless moving?
  1784.       prechar = @preceding_character
  1785.       if $game_player.showing_pet
  1786.         if prechar.is_a?(Game_Player) and !prechar.followers.gathering? and
  1787.            !prechar.just_jumped
  1788.           sx = distance_x_from(prechar.x - prechar.adjustpxy[0])
  1789.           sy = distance_y_from(prechar.y - prechar.adjustpxy[1])
  1790.         else
  1791.           sx = distance_x_from(prechar.x) ; sy = distance_y_from(prechar.y)
  1792.         end
  1793.       else
  1794.         sx = distance_x_from(prechar.x) ; sy = distance_y_from(prechar.y)
  1795.       end
  1796.       if sx != 0 && sy != 0
  1797.         move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  1798.       elsif sx != 0
  1799.         move_straight(sx > 0 ? 4 : 6)
  1800.       elsif sy != 0
  1801.         move_straight(sy > 0 ? 8 : 2)
  1802.       end
  1803.     end
  1804.   end
  1805. end
  1806.  
  1807. #===============================================================================
  1808. # * Scenes and Windows
  1809. #===============================================================================
  1810.  
  1811. # Window base new methods
  1812. class Window_Base < Window
  1813.   def draw_petmoodbar(x, y)
  1814.     contents.font.color = normal_color
  1815.     mood = $game_player.gamepet.mood
  1816.     max = $game_player.gamepet.grow_inflation[0]
  1817.     contents.fill_rect(x, y, 102, 10, Color.new(0, 0, 0))
  1818.     contents.fill_rect(x+1, y+1, 100 *mood / max, 4, Color.new(180, 225, 245))
  1819.     contents.fill_rect(x+1, y+5, 100 *mood / max, 4, Color.new(20, 160, 225))
  1820.     contents.font.size = 16
  1821.     contents.draw_text(x,y -24,self.width, 32, 'Mood: ' + mood.to_s + "/#{max}")
  1822.   end
  1823.  
  1824.   def draw_petname(x, y, a=0)
  1825.     contents.font.size = 18
  1826.     contents.font.color = normal_color
  1827.     lv = $game_player.gamepet.pet_level ; name = $game_player.gamepet.petname
  1828.     contents.draw_text(x, y, self.width, 32, name + " Lv #{lv}", a)
  1829.   end
  1830.  
  1831.   def draw_petgift(x, y)
  1832.     contents.fill_rect(x, y - 18, 106, 76, Color.new(0, 0, 0, 60))
  1833.     item = $game_player.gamepet.mood_item
  1834.     draw_icon(item.icon_index, x + 30, y - 3)
  1835.     contents.font.size = 15
  1836.     contents.font.color = normal_color
  1837.     contents.draw_text(x -2, y - 24, 90, 32, 'Gift', 1)
  1838.     contents.draw_text(x, y + 10, 90, 32, item.name, 1)
  1839.   end
  1840.  
  1841.   def draw_stealed_item(x, y)
  1842.     contents.fill_rect(x + 160, y - 21, 30, 30, Color.new(0, 0, 0, 60))
  1843.     contents.font.color = normal_color
  1844.     contents.font.size = 18
  1845.     item = $game_player.gamepet.stealed_item
  1846.     if item.is_a? Fixnum
  1847.       draw_icon(344, x + 163, y - 19)
  1848.       text = item.to_s + " #{Vocab::currency_unit}"
  1849.     else
  1850.       text = item.name
  1851.       draw_icon(item.icon_index, x + 163, y - 19)
  1852.     end
  1853.     contents.draw_text(x, y + 1, 200, 32, "Have stealed #{text}!")
  1854.   end
  1855. end
  1856.  
  1857. #-------------------------------------------------------------------------------
  1858. # Pets commands selectable
  1859. class Window_PetCommands < Window_Selectable
  1860.   def initialize(x=0, y=0, w=350, h=242) #192
  1861.     super(x, y + 76,  w, h)
  1862.     self.z = 101
  1863.     refresh
  1864.     self.index = 0
  1865.     activate if !busy?
  1866.   end
  1867.  
  1868.   def busy?
  1869.     return true if $game_player.gamepet.busy? || $game_player.in_airship? ||
  1870.     $game_player.in_boat? || $game_player.in_ship?
  1871.     return false
  1872.   end
  1873.  
  1874.   def item
  1875.     return @data[self.index]
  1876.   end
  1877.  
  1878.   def refresh
  1879.     self.contents.clear if self.contents != nil
  1880.     @data = []
  1881.     FalPet::Commands.sort.reverse.each do |id, command |
  1882.       next if id == 27
  1883.       @data.push(command) if id == 1 or id == 26
  1884.       @data.push(command) if $game_player.gamepet.unlock_command.include?(id)
  1885.       next if id == 26
  1886.       next unless id.between?(10, FalPet::Commands.keys.size)
  1887.       @data.push(command) if
  1888.       FalPet::Speciality[$game_player.gamepet.pet_id].include?(id)
  1889.     end
  1890.     @item_max = @data.size
  1891.     if @item_max > 0
  1892.       self.contents = Bitmap.new(width - 32, row_max * 26)
  1893.       for i in 0...@item_max
  1894.         draw_item(i)
  1895.       end
  1896.     end
  1897.   end
  1898.  
  1899.   def draw_item(index)
  1900.     item = @data[index]
  1901.     x, y = index % col_max * (145 + 32), index / col_max  * 24
  1902.     self.contents.font.size = 18
  1903.     draw_icon(item[2], x, y, !$game_player.gamepet.busy? )
  1904.     unless busy?
  1905.       cool_down(item[1]) > 0 ? self.contents.font.color = disable_color :
  1906.       self.contents.font.color = normal_color
  1907.     else
  1908.       self.contents.font.color = disable_color
  1909.     end
  1910.     self.contents.font.color = disable_color  if item[1] != 1 and
  1911.     !$game_player.showing_pet
  1912.     self.contents.draw_text(x + 24, y, 212, 32, item[0], 0)
  1913.   end
  1914.  
  1915.   def disable_color
  1916.     return Color.new(255, 255, 255, 128)
  1917.   end
  1918.  
  1919.   def cool_down(i)
  1920.     cd = $game_player.gamepet
  1921.     cooldown = 0
  1922.     FalPet::Commands.each do |id, cmd |
  1923.       cooldown = cd.cooldown[cmd[1]-1] if i == id and cd.cooldown[cmd[1] -1] > 0
  1924.     end
  1925.     return cooldown
  1926.   end
  1927.  
  1928.   def cool_data(i)
  1929.     data = [false, nil]
  1930.     FalPet::Commands.each do |id, cmd |
  1931.       data = [true, cmd[1] - 1] if i == id
  1932.     end
  1933.     return data
  1934.   end
  1935.  
  1936.   def item_max
  1937.     return @item_max.nil? ? 0 : @item_max
  1938.   end
  1939.  
  1940.   def col_max
  1941.     return 2
  1942.   end
  1943. end
  1944.  
  1945. #-------------------------------------------------------------------------------
  1946. # Scene pet commands
  1947. class Scene_PetCommands < Scene_Base
  1948.   def start
  1949.     super
  1950.     @pet = $game_player.gamepet
  1951.     x, y  = 544 / 2 - 350 / 2, 10
  1952.     @info_window = Window_Base.new(x, y, 350, 76)
  1953.     @color = Color.new(255, 120, 0, 255)
  1954.     @petCommand_window = Window_PetCommands.new(x, y)
  1955.     @mood_window = Window_Base.new(x, y + 76 + 242, 350, 76)
  1956.     @mood_window.draw_petmoodbar(0, 38)
  1957.     @mood_window.draw_petname(0, -8)
  1958.     @mood_window.draw_character(@pet.character_name,@pet.character_index,170,54)
  1959.     @mood_window.draw_petgift(236, 20)
  1960.     @background_sprite = Sprite.new
  1961.     @background_sprite.bitmap = SceneManager.background_bitmap
  1962.     @refresh_delay = 0
  1963.     refresh_info
  1964.   end
  1965.  
  1966.   def refresh_info
  1967.     @info_window.contents.clear
  1968.     @info_window.contents.font.size = 18
  1969.     @info_window.contents.font.color = @info_window.normal_color
  1970.     @petCommand_window.busy? ? text = 'Pet is busy...' :
  1971.     text = @petCommand_window.item[6]
  1972.     @info_window.contents.draw_text(- 10, 0,@info_window.width, 32, text, 1)
  1973.     action = @petCommand_window.item[9]
  1974.     mood = @petCommand_window.item[8]
  1975.     mood = '' if mood == 0
  1976.     @info_window.contents.draw_text(0, 28, @info_window.width, 32,
  1977.     'Type: ' + action + " #{mood}")
  1978.     cooldown > 0 ? operand = cooldown : operand = @petCommand_window.item[7] *60
  1979.     operand = @pet.instantcd if @pet.instantcd > 0
  1980.     total_sec = operand / Graphics.frame_rate
  1981.     cd = sprintf("%02d:%02d", total_sec / 60, total_sec % 60)
  1982.     if @pet.instantcd > 0
  1983.       text = "Instant!:  #{cd}"
  1984.       @info_window.contents.font.color = @color
  1985.     else
  1986.       text = "Cooldown:  #{cd}"
  1987.     end
  1988.     @info_window.contents.draw_text(-50, 28, 350, 32, text, 2)
  1989.   end
  1990.  
  1991.   def cooldown
  1992.     return @petCommand_window.cool_down(@petCommand_window.item[1])
  1993.   end
  1994.  
  1995.   def update
  1996.     super
  1997.     if Input.trigger?(:B)
  1998.       SceneManager.goto(Scene_Map)
  1999.       Sound.play_cancel
  2000.     end
  2001.     return if @petCommand_window.busy?
  2002.     update_refresh
  2003.     if Input.trigger?(:C)
  2004.       cmd = @petCommand_window
  2005.       if cmd.item[1] != 1
  2006.         if cooldown > 0 || !$game_player.showing_pet
  2007.           Sound.play_buzzer
  2008.           return
  2009.         end
  2010.       end
  2011.       Sound.play_ok
  2012.       if @petCommand_window.item[4]
  2013.         apply_cooldown(cmd)
  2014.         SceneManager.callp(Scene_Event, @petCommand_window.item[1])
  2015.       elsif @petCommand_window.item[5]
  2016.         apply_cooldown(cmd)
  2017.         SceneManager.goto(Scene_Pets)
  2018.       else
  2019.         apply_cooldown(cmd)
  2020.         @pet.command = @petCommand_window.item[1]
  2021.         @pet.action_time = @petCommand_window.item[3]
  2022.         if @pet.custom_command?
  2023.           @pet.action_time = @pet.action_time + 1 if (@pet.action_time%2 == 0)
  2024.         end
  2025.         @pet.jumpto(0) if @petCommand_window.item[1] == 1 and
  2026.         $game_player.showing_pet
  2027.         @pet.reservedmood = cmd.item[8] if cmd.item[8] != nil
  2028.         SceneManager.goto(Scene_Map)
  2029.       end
  2030.     end
  2031.   end
  2032.  
  2033.   def update_refresh
  2034.     refresh_info if cooldown > 0 || @pet.instantcd > 0
  2035.     if @index != @petCommand_window.index
  2036.       @index = @petCommand_window.index
  2037.       refresh_info
  2038.     end
  2039.     @refresh_delay -= 1 if @refresh_delay > 0
  2040.     @refresh_delay = 2 if @pet.instantcd == 1
  2041.     if @refresh_delay == 1
  2042.       @petCommand_window.refresh
  2043.       refresh_info
  2044.     end
  2045.     for i in 0...@pet.cooldown.size
  2046.       if @pet.cooldown[i] == 1
  2047.         @refresh_delay = 2
  2048.       end
  2049.     end
  2050.   end
  2051.  
  2052.   def apply_cooldown(cmd)
  2053.     if cmd.cool_data(cmd.item[1])[0] and cmd.cool_down(cmd.item[1]) == 0
  2054.       index = cmd.cool_data(cmd.item[1])[1]
  2055.       @pet.cooldown[index] = @petCommand_window.item[7] * 60
  2056.     end
  2057.   end
  2058.  
  2059.   def terminate
  2060.     super
  2061.     @petCommand_window.dispose
  2062.     @background_sprite.dispose
  2063.     @info_window.dispose
  2064.   end
  2065. end
  2066.  
  2067. #-------------------------------------------------------------------------------
  2068. # Invisible window event selection
  2069. class Window_Event < Window_Selectable
  2070.   attr_reader   :participants
  2071.   def initialize(x=0, y=0, w=150, h=192)
  2072.     super(x, y,  w, h)
  2073.     self.z = 101
  2074.     @participants = []
  2075.     refresh
  2076.     self.index = 0
  2077.     self.visible = false
  2078.     activate
  2079.   end
  2080.  
  2081.   def item
  2082.     return @data[self.index]
  2083.   end
  2084.  
  2085.   def refresh
  2086.     self.contents.clear if self.contents != nil
  2087.     @data = []
  2088.     for event in $game_map.events.values
  2089.       if event.on_current_screen?
  2090.         next if event.tile_id == 0 and event.character_name == ""
  2091.         next if event.check_evcom("/IGNORE TARGETING")
  2092.         @data.push(event)
  2093.         event.target_index = @data.size - 1
  2094.         @participants.push(event)
  2095.       end
  2096.     end
  2097.     @item_max = @data.size
  2098.     if @item_max > 0
  2099.       self.contents = Bitmap.new(width - 32, row_max * 26)
  2100.       for i in 0...@item_max
  2101.         draw_item(i)
  2102.       end
  2103.     end
  2104.   end
  2105.  
  2106.   def draw_item(index)
  2107.     item = @data[index]
  2108.     x, y = index % col_max * (120 + 32), index / col_max  * 24
  2109.     self.contents.font.size = 16
  2110.     self.contents.draw_text(x + 24, y, 212, 32, item.id.to_s, 0)
  2111.   end
  2112.  
  2113.   def item_max
  2114.     return @item_max.nil? ? 0 : @item_max
  2115.   end
  2116.  
  2117.   def col_max
  2118.     return 1
  2119.   end
  2120. end
  2121.  
  2122. #-------------------------------------------------------------------------------
  2123. # Scenen events selection target
  2124. class Scene_Event < Scene_Base
  2125.   def initialize(command)
  2126.     @command = command
  2127.   end
  2128.  
  2129.   def start
  2130.     super
  2131.     @mouse_exist = defined?(Map_Buttons).is_a?(String)
  2132.     @event_window = Window_Event.new
  2133.     @info_window = Sprite.new
  2134.     @info_window.bitmap = Bitmap.new(300, 60)
  2135.     @info_window.z = 900; @info_window.x = 544/2 -200/2; @info_window.y = 180
  2136.     @info_window.bitmap.font.size = 28; @info_window.bitmap.font.bold = true
  2137.     @event_window.item.nil? ? t = 'No targets!' : t = 'Select target'
  2138.     @info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
  2139.     @background_sprite = Sprite.new
  2140.     @background_sprite.bitmap = SceneManager.background_bitmap
  2141.     @info_time = 60
  2142.     create_cursor unless @event_window.item.nil?
  2143.   end
  2144.  
  2145.   def refresh_info(type)
  2146.     @info_window.bitmap.clear
  2147.     t = 'I cant climb that bich!' if type == 1
  2148.     t = 'Invalid Target!' if type == 2
  2149.     @info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
  2150.   end
  2151.  
  2152.   def create_cursor
  2153.     if @mouse_exist
  2154.       @cursor = $mouse_cursor
  2155.       @cursor_zooming = 0 ; update_cursor_position
  2156.       return
  2157.     end
  2158.    
  2159.     @cursor = Sprite.new
  2160.     icon = FalPet::CursorIcon
  2161.     @cursor.bitmap = Bitmap.new(24, 24)
  2162.     bitmap = Cache.system("Iconset")
  2163.     rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  2164.     @cursor.bitmap.blt(0, 0, bitmap, rect)
  2165.     @cursor_zooming = 0
  2166.     update_cursor_position
  2167.   end
  2168.  
  2169.   def update
  2170.     super
  2171.     if Input.trigger?(:B)
  2172.       SceneManager.goto(Scene_PetCommands)
  2173.       Sound.play_cancel
  2174.     end
  2175.     @info_time -= 1 if @info_time > 0
  2176.     if @info_time == 0
  2177.       @info_window.opacity -= 8 if @info_window.opacity > 0
  2178.       if @info_window.opacity == 0 and @event_window.item.nil?
  2179.         Sound.play_cancel
  2180.         SceneManager.goto(Scene_PetCommands)
  2181.       end
  2182.     end
  2183.      
  2184.     return if @event_window.item.nil?
  2185.     update_cursor_position
  2186.     update_target_selection
  2187.   end
  2188.  
  2189.   # target selection
  2190.   def update_target_selection
  2191.     if Input.trigger?(:C)
  2192.       if @mouse_exist
  2193.         for event in @event_window.participants
  2194.           if Mouse.map_grid[0] == event.x and Mouse.map_grid[1] == event.y
  2195.             @event_window.select(event.target_index)
  2196.             @selected = true
  2197.           end
  2198.         end
  2199.         if @selected.nil?
  2200.           refresh_info(2)
  2201.           @info_time = 60; @info_window.opacity = 255
  2202.           Sound.play_buzzer
  2203.           return
  2204.         end
  2205.       end
  2206.       if @command == 13 and not @event_window.item.check_evcom("/PET CLIMB")
  2207.         refresh_info(1)
  2208.         @info_time = 60; @info_window.opacity = 255
  2209.         Sound.play_buzzer
  2210.         return
  2211.       end
  2212.       Sound.play_ok
  2213.       $game_player.gamepet.chase_event_id = @event_window.item.id
  2214.       $game_player.gamepet.command = @command
  2215.       SceneManager.goto(Scene_Map)
  2216.     end
  2217.   end
  2218.  
  2219.   def update_cursor_position
  2220.     if @mouse_exist
  2221.       @cursor.x = Mouse.pos[0]
  2222.       @cursor.y = Mouse.pos[1]
  2223.     else
  2224.       @cursor.x = @event_window.item.screen_x
  2225.       @cursor.y = @event_window.item.screen_y - 16
  2226.     end
  2227.     @cursor_zooming += 1
  2228.     case @cursor_zooming
  2229.     when 1..10 ; @cursor.zoom_x -= 0.01 ; @cursor.zoom_y -= 0.01
  2230.     when 11..20; @cursor.zoom_x += 0.01 ; @cursor.zoom_y += 0.01
  2231.     when 21..30; @cursor.zoom_x = 1.0   ; @cursor.zoom_y = 1.0
  2232.       @cursor_zooming = 0
  2233.     end
  2234.   end
  2235.  
  2236.   def terminate
  2237.     super
  2238.     @event_window.dispose
  2239.     @background_sprite.dispose
  2240.     @info_window.dispose
  2241.     @info_window.bitmap.dispose
  2242.     if @mouse_exist
  2243.       @cursor.zoom_x = 1.0   ; @cursor.zoom_y = 1.0 ; @selected = nil
  2244.     else
  2245.       @cursor.dispose unless @cursor.nil?
  2246.       @cursor.bitmap.dispose unless @cursor.nil?
  2247.     end
  2248.   end
  2249. end
  2250.  
  2251. #-------------------------------------------------------------------------------
  2252. # Window pets
  2253. class Window_Pets < Window_Selectable
  2254.   def initialize(shop)
  2255.     super(0, 0,  406, 122)
  2256.     self.z = 101
  2257.     @shop = shop
  2258.     refresh
  2259.     self.index = 0
  2260.     activate
  2261.   end
  2262.  
  2263.   def item
  2264.     return @data[self.index]
  2265.   end
  2266.  
  2267.   def refresh
  2268.     self.contents.clear if self.contents != nil
  2269.     @data = []
  2270.     FalPet::Pets.each do |id , pet|
  2271.       pet.push(id) unless pet.include?(id)
  2272.       @data.push(pet) if @shop
  2273.       @data.push(pet) if $game_player.adopted_pets.include?(id) and !@shop
  2274.     end
  2275.     @item_max = @data.size
  2276.     if @item_max > 0
  2277.       self.contents = Bitmap.new(width - 32, row_max * 26)
  2278.       for i in 0...@item_max
  2279.         draw_item(i)
  2280.       end
  2281.     end
  2282.   end
  2283.  
  2284.   def draw_item(index)
  2285.     item = @data[index]
  2286.     x, y = index % col_max * (107 + 32), index / col_max  * 24
  2287.     self.contents.font.size = 18
  2288.     self.contents.draw_text(x, y, 212, 32, item[2], 0)
  2289.   end
  2290.  
  2291.   def item_max
  2292.     return @item_max.nil? ? 0 : @item_max
  2293.   end
  2294.  
  2295.   def col_max
  2296.     return 3
  2297.   end
  2298. end
  2299.  
  2300. #-------------------------------------------------------------------------------
  2301. # Scene pets base, refered at pep shop and pets adopted
  2302. class Scene_PetsBase < Scene_Base
  2303.   def start
  2304.     super
  2305.     @pet = $game_player.gamepet
  2306.     SceneManager.scene_is?(Scene_PetShop) ? @shop = true : @shop = false
  2307.     @pet_window = Window_Pets.new(@shop)
  2308.     x, y = 544 / 2 -406 / 2, 0
  2309.     @pet_window.x = x
  2310.     @pet_window.y = y + 110
  2311.     @info_window = Window_Base.new(x, y, 406, 110)
  2312.     @bonus_window = Window_Base.new(x, y + 122 + 110, 406, 184)
  2313.     @background_sprite = Sprite.new
  2314.     @background_sprite.bitmap = SceneManager.background_bitmap
  2315.     refresh_infodata
  2316.   end
  2317.  
  2318.   def refresh_infodata
  2319.     @info_window.contents.clear
  2320.     @info_window.contents.font.size = 18
  2321.     @shop ? xy = [0, 0] : xy = [286, 0]
  2322.     @info_window.contents.fill_rect(xy[0], xy[1],90,76, Color.new(0,0,0,60))
  2323.     @info_window.draw_character(@pet_window.item[0],
  2324.     @pet_window.item[1], xy[0] + 45, xy[1] + 64)
  2325.     @info_window.draw_text(xy[0] + 20, xy[1] + 66, 350, 32, 'Pet id')
  2326.     create_price_info if @shop
  2327.     refresh_bonus
  2328.     return if @shop
  2329.     @info_window.contents.fill_rect(0, -18, 90, 90, Color.new(0, 0, 0, 60))
  2330.     @info_window.draw_text(0, 64, @info_window.width, 32, 'Current Pet')
  2331.     @info_window.draw_text(-16, 0, @info_window.width, 32, @pet.petname, 1)
  2332.     @info_window.draw_character(@pet.character_name,@pet.character_index,45,64)
  2333.   end
  2334.  
  2335.   def refresh_bonus
  2336.     @bonus_window.contents.clear
  2337.     @bonus_window.contents.font.size = 20
  2338.     y = 0; manager = 0
  2339.     @bonus_window.contents.font.color = Color.new(255, 120, 0, 255)
  2340.     @bonus_window.draw_text(40, -6, 406, 32, 'Pet Special Skills', 1)
  2341.     @bonus_window.draw_text(0, -6, 406, 32, 'Bonus')
  2342.     @bonus_window.contents.font.color = @bonus_window.normal_color
  2343.    
  2344.     # draw speciality
  2345.     @bonus_window.contents.font.size = 16
  2346.     enable = FalPet::Speciality[@pet_window.item[6]]
  2347.     FalPet::Commands.each do |id, command |
  2348.       if enable.include?(id)
  2349.         manager += 1
  2350.         (manager%2 == 0) ? x = 260 : y += 17
  2351.         x = 128 unless (manager%2 == 0)
  2352.         @bonus_window.draw_text(x, y, @bonus_window.width, 32, command[0])
  2353.       end
  2354.     end
  2355.    
  2356.     #draw bonus parameters
  2357.     bonus = FalPet::Bonus[@pet_window.item[6]]
  2358.     y = 0
  2359.     for i in 0...8
  2360.       y += 17
  2361.       @bonus_window.draw_text(0, y, 406, 32, Vocab.param(i))
  2362.       @bonus_window.draw_text(58, y, 406, 32, "=> #{bonus[i].to_s}")
  2363.     end
  2364.   end
  2365.  
  2366.   def create_price_info
  2367.     @info_window.contents.font.size = 22
  2368.     @info_window.draw_text(156, 0, @info_window.width, 32, 'Pet Shop')
  2369.     @info_window.contents.font.size = 18
  2370.     @info_window.draw_text(156, 32, 350, 32, "Name: #{@pet_window.item[2]}")
  2371.     v = pet_price
  2372.     @info_window.draw_text(156,64,350,18,"Price: $#{v} " + Vocab::currency_unit)
  2373.     @info_window.contents.fill_rect(320, -18, 62, 56, Color.new(0, 0, 0, 60))
  2374.     @info_window.draw_text(28, 0, 350, 18, $game_party.gold.to_s, 2)
  2375.     @info_window.draw_text(28, 18, 350, 18, Vocab::currency_unit, 2)
  2376.   end
  2377.  
  2378.   def pet_price
  2379.     return FalPet::Price[@pet_window.item[6]]
  2380.   end
  2381.  
  2382.   def terminate
  2383.     super
  2384.     @bonus_window.dispose
  2385.     @background_sprite.dispose
  2386.     @info_window.dispose
  2387.     @pet_window.dispose
  2388.   end
  2389. end
  2390.  
  2391. #-------------------------------------------------------------------------------
  2392. # Scene pet adopted
  2393. class Scene_Pets < Scene_PetsBase
  2394.  
  2395.   def start() super end
  2396.   def update
  2397.     super
  2398.     if Input.trigger?(:B)
  2399.       SceneManager.goto(Scene_PetCommands)
  2400.       Sound.play_cancel
  2401.     end
  2402.     if @index != @pet_window.index
  2403.       @index = @pet_window.index
  2404.       refresh_infodata
  2405.     end
  2406.     if Input.trigger?(:C)
  2407.       @pet.setup_pet(@pet_window.item[6])
  2408.       refresh_infodata    
  2409.     end
  2410.   end
  2411. end
  2412.  
  2413. #-------------------------------------------------------------------------------
  2414. # Scene pet shop
  2415.  
  2416. class Scene_PetShop < Scene_PetsBase
  2417.  
  2418.   def start
  2419.     super
  2420.     @pop_window = Window_Base.new(200, 170, 150, 110)
  2421.     @pop_window.z = 500
  2422.     @pop_time = 0
  2423.     @pop_window.visible = false
  2424.   end
  2425.  
  2426.   def refresh_pop(type)
  2427.     @pop_window.contents.clear
  2428.     @pop_window.contents.font.size = 18
  2429.     case type
  2430.     when 1
  2431.       @pop_window.draw_text(0, 0, @pop_window.width, 32, "You have buyed!")
  2432.       @pop_window.draw_text(0, 22, @pop_window.width, 32, @pet_window.item[2])
  2433.       @pop_window.draw_text(0, 44, @pop_window.width, 32,
  2434.       Vocab::currency_unit + " -#{pet_price}")
  2435.     when 2
  2436.       @pop_window.draw_text(0, 0, 200, 32, "You dont have")
  2437.       @pop_window.draw_text(0, 22, 200, 32, "enough #{Vocab::currency_unit}")
  2438.     when 3
  2439.       @pop_window.draw_text(0, 0, @pop_window.width, 32, "You already owned!")
  2440.       @pop_window.draw_text(0, 22, @pop_window.width, 32, @pet_window.item[2])
  2441.     end
  2442.   end
  2443.  
  2444.   def update
  2445.     super
  2446.     if Input.trigger?(:B)
  2447.       SceneManager.goto(Scene_Map)
  2448.       Sound.play_cancel
  2449.     end
  2450.     if @index != @pet_window.index
  2451.       @index = @pet_window.index
  2452.       refresh_infodata
  2453.     end
  2454.     update_buying
  2455.   end
  2456.  
  2457.   def update_buying
  2458.     @pop_time -= 1 if @pop_time > 0
  2459.     @pop_time > 0 ? @pop_window.visible = true : @pop_window.visible = false
  2460.     if Input.trigger?(:C)
  2461.       if $game_player.adopted_pets.include?(@pet_window.item[6])
  2462.         refresh_pop(3)
  2463.         @pop_time = 2 * 60
  2464.         Sound.play_cancel
  2465.         return
  2466.       end
  2467.       if $game_party.gold >= pet_price
  2468.         $game_party.lose_gold(pet_price)
  2469.         RPG::SE.new("Shop", 80,).play
  2470.         $game_player.adopt_pet(@pet_window.item[6])
  2471.         refresh_infodata
  2472.         refresh_pop(1)
  2473.         @pop_time = 2 * 60
  2474.       else
  2475.         refresh_pop(2)
  2476.         @pop_time = 2 * 60
  2477.         Sound.play_buzzer
  2478.       end
  2479.     end
  2480.   end
  2481.  
  2482.   def terminate
  2483.     super
  2484.     @pop_window.dispose
  2485.   end
  2486. end
  2487.  
  2488. #-------------------------------------------------------------------------------
  2489.  
  2490. # update global cool down
  2491. class << Input
  2492.   unless self.method_defined?(:falcaopet_ccd_update)
  2493.     alias_method :falcaopet_ccd_update,   :update
  2494.   end
  2495.  
  2496.   def update
  2497.     update_cooldown_system
  2498.     falcaopet_ccd_update
  2499.   end
  2500.  
  2501.   def update_cooldown_system
  2502.     player = $game_player
  2503.     unless player.nil?
  2504.       player.gamepet.instantcd -= 1 if player.gamepet.instantcd > 0
  2505.       for i in 0...player.gamepet.cooldown.size
  2506.         if player.gamepet.cooldown[i] > 0 and player.gamepet.instantcd > 0    
  2507.           player.gamepet.cooldown[i] = 0 if not i == 19 - 1
  2508.         end
  2509.         player.gamepet.cooldown[i] -= 1 if player.gamepet.cooldown[i] > 0
  2510.       end
  2511.     end
  2512.   end
  2513. end
  2514.  
  2515. module SceneManager
  2516.   def self.callp(scene_class, *args)
  2517.     @scene = scene_class.new(*args)
  2518.   end
  2519. end
  2520.  
  2521. #-------------------------------------------------------------------------------
  2522. # FA Interactive System 2.0 pet plug-ins
  2523.  
  2524. class Game_Player < Game_Character
  2525.   if defined?(FalInt).is_a?(String)
  2526.     alias falcaopetplugins_fall player_start_falling
  2527.     def player_start_falling
  2528.       @showing_pet = false
  2529.       $game_system.replay_bgm if @gamepet.command == 8 ; globalpet_reset
  2530.       falcaopetplugins_fall
  2531.     end
  2532.   end
  2533. end
  2534.  
  2535. class Game_CharacterBase
  2536.   if defined?(FalInt).is_a?(String)
  2537.     alias falcaopetplugins_start_jump start_jump
  2538.     def start_jump(power)
  2539.       player = self.is_a?(Game_Player)
  2540.       if player and Input.dir4 != 0
  2541.         self.followers.reverse_each {|f| f.move_toward_player }
  2542.         self.gamepet.move_toward_player ; self.gamepet.move_toward_player
  2543.         self.gamepet.jump(0,  power)  if @direction == 2
  2544.         self.gamepet.jump(- power, 0) if @direction == 4
  2545.         self.gamepet.jump(power,  0)  if @direction == 6
  2546.         self.gamepet.jump(0, - power) if @direction == 8
  2547.         self.just_jumped = true
  2548.       end
  2549.       falcaopetplugins_start_jump(power)
  2550.     end
  2551.   end
  2552. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement