Guest User

Yanfly Engine Ace - TP Manager v1.04

a guest
Mar 8th, 2014
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - TP Manager v1.04
  4. # -- Last Updated: 2012.01.30
  5. # -- Level: Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-TPManager"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.30 - Bug Fixed: Notetags didn't unlock TP Mode 0.
  17. #              Compatibility Update: Ace Battle Engine v1.19.
  18. # 2012.01.02 - Compatibility Update: Ace Skill Menu
  19. # 2011.12.10 - Added <tp cost: x> notetag.
  20. # 2011.12.06 - Fixed an error in one of the formulas.
  21. # 2011.12.05 - Started Script and Finished.
  22. #
  23. #==============================================================================
  24. # ▼ Introduction
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # The TP system in RPG Maker VX Ace is actually rather limiting. A lot of the
  27. # system is hardcoded in giving Ace users very little control over how much TP
  28. # gain a battler can receive from particular actions and situations. This
  29. # script gives you the ability to adjust how much TP actors will acquire from
  30. # various actions, different TP modes, and letting players select and pick what
  31. # TP mode they want for each actor (akin to Final Fantasy X).
  32. #
  33. #==============================================================================
  34. # ▼ Instructions
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # To install this script, open up your script editor and copy/paste this script
  37. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  38. #
  39. # -----------------------------------------------------------------------------
  40. # Actor Notetags - These notetags go in the actors notebox in the database.
  41. # -----------------------------------------------------------------------------
  42. # <tp mode: x>
  43. # This sets the actor's default TP mode to x. If this tag isn't used, the
  44. # default TP mode will be set to whatever the module uses as default.
  45. #
  46. # <unlock tp: x>
  47. # <unlock tp: x, x>
  48. # This unlocks what TP modes the actor can use by default. If this tag isn't
  49. # used, the default unlocked TP modes will be whatever the module uses.
  50. #
  51. # -----------------------------------------------------------------------------
  52. # Item Notetags - These notetags go in the item notebox in the database.
  53. # -----------------------------------------------------------------------------
  54. # <unlock tp: x>
  55. # <unlock tp: x, x>
  56. # When this item is used upon an actor, that actor will learn TP Mode(s) x,
  57. # making it available to change in the TP Menu.
  58. #
  59. # -----------------------------------------------------------------------------
  60. # Skill Notetags - These notetags go in the skill notebox in the database.
  61. # -----------------------------------------------------------------------------
  62. # <unlock tp: x>
  63. # <unlock tp: x, x>
  64. # When this skill targets an actor, that actor will learn TP Mode(s) x thus,
  65. # making it available to change in the TP Menu.
  66. #
  67. # <learn unlock tp: x>
  68. # <learn unlock tp: x, x>
  69. # When an actor learns a skill with this notetag, that actor will learn
  70. # TP Mode(s) x making it available to change in the TP Menu.
  71. #
  72. # <tp cost: x>
  73. # When this notetag appears in a skill's notebox, the TP cost for that skill
  74. # becomes x. This notetag allows TP costs to surpass 100 TP, which is the max
  75. # TP cost in the RPG Maker VX Ace database editor.
  76. #
  77. # -----------------------------------------------------------------------------
  78. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  79. # -----------------------------------------------------------------------------
  80. # <tp mode: x>
  81. # This sets the enemy's default TP mode to x. If this tag isn't used, the
  82. # default TP mode will be set to whatever the module uses as default.
  83. #
  84. # -----------------------------------------------------------------------------
  85. # Script Calls - These commands are used with script calls.
  86. # -----------------------------------------------------------------------------
  87. # change_tp_mode(x, y)
  88. # Replace x with the ID of the actor you want to change to the TP Mode y. This
  89. # will also unlock the TP mode for the actor, and make it available under the
  90. # skill menu for changing.
  91. #
  92. # unlock_tp_mode(x, y)
  93. # Replace x with the ID of the actor you want to learn for the TP Mode y. This
  94. # will cause the actor to learn the TP mode and have it accessible in the skill
  95. # menu for changing.
  96. #
  97. # remove_tp_mode(x, y)
  98. # Replace x with the ID of the actor you want to remove the TP Mode y. This
  99. # will cause the actor to forget the TP mode and no longer have it accessible
  100. # through the skill menu for changing.
  101. #
  102. # unlock_all_tp_modes(x)
  103. # Replace x with the ID of the actor you want to unlock all TP modes for. This
  104. # will make all the TP modes available to the actor from the skill menu.
  105. #
  106. # remove_all_tp_modes(x)
  107. # Removes all TP modes for actor x except for the actor's default TP mode.
  108. # This removes all TP modes from being available in the actor's skill menu.
  109. #
  110. #==============================================================================
  111. # ▼ Compatibility
  112. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  113. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  114. # it will run with RPG Maker VX without adjusting.
  115. #
  116. #==============================================================================
  117.  
  118. module YEA
  119.   module TP_MANAGER
  120.    
  121.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  122.     # - General TP Settings -
  123.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  124.     # Here, you can adjust global settings for TP including the maximum TP,
  125.     # whether or not you want the player to change TP modes, and more.
  126.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  127.     TP_LIMIT  = 100         # Sets the maximum TP. Default: 100
  128.     DEFAULT_TP_MODE = 0            # This is the TP mode everybody starts with
  129.                                    # unless changed through notetags.
  130.     DEFAULT_UNLOCKS = [0, 1, 2, 3] # These modes are unlocked for all actors
  131.                                    # unless changed through notetags.
  132.     LOW_HP = 0.25           # Percent for what is considered low HP.
  133.     LOW_MP = 0.25           # Percent for what is considered low MP.
  134.    
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # - TP Mode Change Settings -
  137.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  138.     # Adjust the settings here for TP Mode Menu related items. Also, be sure
  139.     # to bind the TP_MODE_SWITCH to a switch ID. If that switch is on, the
  140.     # TP Mode item will appear in the skill menu. If off, it won't appear.
  141.     # If you set it to 0, then TP mode will always be enabled.
  142.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  143.     MENU_NAME = "TP Mode"   # The displayed name for the TP Menu.
  144.     TP_MODE_SWITCH  = 0     # Switch ID used for enabling TP Mode menu.
  145.     DEFAULT_ENABLE  = true  # Enable switch by default?
  146.     CHANGE_TP_RESET = true  # Reset TP to 0 whenever a mode is changed?
  147.     EQUIPPED_COLOUR = 17    # Window text colour used for equipped TP mode.
  148.    
  149.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  150.     # - TP Modes -
  151.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  152.     # TP modes have a number of things that can change the way actors gain TP.
  153.     # Adjust the settings below to change how much gain and loss incurs per
  154.     # each of the different actions.
  155.     #
  156.     # Setting        Description
  157.     # -------------------------------------------------------------------------
  158.     # - :name        - Name that appears in the TP Mode menu.
  159.     # - :icon        - Icon used for the TP Mode menu.
  160.     # - :description - Help window description. Use \n for line breaks.
  161.     # - :preserve_tp - Carry over TP from last battle to next battle?
  162.     # - :init_tp     - TP at the start of each battle if no TP preservation.
  163.     # - :regen_tp    - TP regenerated each turn. Uses a formula.
  164.     # - :take_hp_dmg - TP charged by receiving HP damage. Uses a formula.
  165.     # - :deal_hp_dmg - TP gained by dealing HP damage. Uses a formula.
  166.     # - :heal_hp_dmg - TP gained through healing HP damage. Uses a formula.
  167.     # - :ally_hp_dmg - TP gained when allies take HP damage. Uses a formula.
  168.     # - :take_mp_dmg - TP charged by receiving MP damage. Uses a formula.
  169.     # - :deal_mp_dmg - TP gained by dealing MP damage. Uses a formula.
  170.     # - :heal_mp_dmg - TP gained through healing MP damage. Uses a formula.
  171.     # - :ally_mp_dmg - TP gained when allies take MP damage. Uses a formula.
  172.     # - :deal_state  - TP gained when user inflicts a state to a foe. Formula.
  173.     # - :gain_state  - TP gained when user gains a state from a foe. Formula.
  174.     # - :kill_ally   - TP gained when an ally is killed. Uses a formula.
  175.     # - :kill_enemy  - TP gained when killing an enemy. Uses a formula.
  176.     # - :win_battle  - TP gained whenever a battle is won. Uses a formula.
  177.     # - :flee_battle - TP gained whenever party escapes. Uses a formula.
  178.     # - :lose_battle - TP gained whenever a battle is lost. Uses a formula.
  179.     # - :low_hp_turn - TP gained at the end of a turn with user at low HP.
  180.     # - :low_mp_turn - TP gained at the end of a turn with user at low MP.
  181.     # - :only_ally   - TP gained when user is only ally alive.
  182.     # - :evasion     - TP gained when user evades an attack.
  183.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  184.     TP_MODES ={
  185.     # TP Mode => { Settings }
  186.     # -------------------------------------------------------------------------
  187.       0 => { # This is the default mode.
  188.       # :setting     => Adjust settings as you see fit.
  189.         :name        => "Stoic",
  190.         :icon        => 121,
  191.         :description => "Raise TP by waiting in battle or receiving damage " +
  192.                         "from\nattacks.",
  193.         :preserve_tp => false,
  194.         :init_tp     => "rand * 25",
  195.         :regen_tp    => "100 * trg",
  196.         :take_hp_dmg => "50 * damage_rate * tcr",
  197.         :deal_hp_dmg => "0",
  198.         :heal_hp_dmg => "0",
  199.         :ally_hp_dmg => "0",
  200.         :take_mp_dmg => "0",
  201.         :deal_mp_dmg => "0",
  202.         :heal_mp_dmg => "0",
  203.         :ally_mp_dmg => "0",
  204.         :deal_state  => "0",
  205.         :gain_state  => "0",
  206.         :kill_ally   => "0",
  207.         :kill_enemy  => "0",
  208.         :win_battle  => "0",
  209.         :flee_battle => "0",
  210.         :lose_battle => "0",
  211.         :low_hp_turn => "0",
  212.         :low_mp_turn => "0",
  213.         :only_alive  => "0",
  214.         :evasion     => "0",
  215.       }, # Do not remove this.
  216.     # -------------------------------------------------------------------------
  217.       1 => { # New TP mode!
  218.       # :setting     => Adjust settings as you see fit.
  219.         :name        => "Comrade",
  220.         :icon        => 122,
  221.         :description => "Raise TP whenever allies take damage.",
  222.         :preserve_tp => true,
  223.         :init_tp     => "0",
  224.         :regen_tp    => "0",
  225.         :take_hp_dmg => "0",
  226.         :deal_hp_dmg => "0",
  227.         :heal_hp_dmg => "0",
  228.         :ally_hp_dmg => "20 * tcr",
  229.         :take_mp_dmg => "0",
  230.         :deal_mp_dmg => "0",
  231.         :heal_mp_dmg => "0",
  232.         :ally_mp_dmg => "0",
  233.         :deal_state  => "0",
  234.         :gain_state  => "0",
  235.         :kill_ally   => "0",
  236.         :kill_enemy  => "0",
  237.         :win_battle  => "0",
  238.         :flee_battle => "0",
  239.         :lose_battle => "0",
  240.         :low_hp_turn => "0",
  241.         :low_mp_turn => "0",
  242.         :only_alive  => "0",
  243.         :evasion     => "0",
  244.       }, # Do not remove this.
  245.     # -------------------------------------------------------------------------
  246.       2 => { # New TP mode!
  247.       # :setting     => Adjust settings as you see fit.
  248.         :name        => "Warrior",
  249.         :icon        => 116,
  250.         :description => "Raise TP by attacking and dealing HP damage.",
  251.         :preserve_tp => true,
  252.         :init_tp     => "0",
  253.         :regen_tp    => "0",
  254.         :take_hp_dmg => "0",
  255.         :deal_hp_dmg => "[@result.hp_damage * 100 / mhp, 16].min * tcr",
  256.         :heal_hp_dmg => "0",
  257.         :ally_hp_dmg => "0",
  258.         :take_mp_dmg => "0",
  259.         :deal_mp_dmg => "0",
  260.         :heal_mp_dmg => "0",
  261.         :ally_mp_dmg => "0",
  262.         :deal_state  => "0",
  263.         :gain_state  => "0",
  264.         :kill_ally   => "0",
  265.         :kill_enemy  => "0",
  266.         :win_battle  => "0",
  267.         :flee_battle => "0",
  268.         :lose_battle => "0",
  269.         :low_hp_turn => "0",
  270.         :low_mp_turn => "0",
  271.         :only_alive  => "0",
  272.         :evasion     => "0",
  273.       }, # Do not remove this.
  274.     # -------------------------------------------------------------------------
  275.       3 => { # New TP mode!
  276.       # :setting     => Adjust settings as you see fit.
  277.         :name        => "Healer",
  278.         :icon        => 112,
  279.         :description => "Raise TP by healing HP.",
  280.         :preserve_tp => true,
  281.         :init_tp     => "0",
  282.         :regen_tp    => "0",
  283.         :take_hp_dmg => "0",
  284.         :deal_hp_dmg => "0",
  285.         :heal_hp_dmg => "[@result.hp_damage * -100 / mhp, 16].min * tcr",
  286.         :ally_hp_dmg => "0",
  287.         :take_mp_dmg => "0",
  288.         :deal_mp_dmg => "0",
  289.         :heal_mp_dmg => "0",
  290.         :ally_mp_dmg => "0",
  291.         :deal_state  => "0",
  292.         :gain_state  => "0",
  293.         :kill_ally   => "0",
  294.         :kill_enemy  => "0",
  295.         :win_battle  => "0",
  296.         :flee_battle => "0",
  297.         :lose_battle => "0",
  298.         :low_hp_turn => "0",
  299.         :low_mp_turn => "0",
  300.         :only_alive  => "0",
  301.         :evasion     => "0",
  302.       }, # Do not remove this.
  303.     # -------------------------------------------------------------------------
  304.       4 => { # New TP mode!
  305.       # :setting     => Adjust settings as you see fit.
  306.         :name        => "Breaker",
  307.         :icon        => 215,
  308.         :description => "Raise TP whenever user deals MP damage, receives MP " +
  309.                         "damage,\nor an ally receives MP damage.",
  310.         :preserve_tp => true,
  311.         :init_tp     => "0",
  312.         :regen_tp    => "0",
  313.         :take_hp_dmg => "0",
  314.         :deal_hp_dmg => "0",
  315.         :heal_hp_dmg => "0",
  316.         :ally_hp_dmg => "0",
  317.         :take_mp_dmg => "50 * damage_rate * tcr",
  318.         :deal_mp_dmg => "[@result.mp_damage / 4, 16].min * tcr",
  319.         :heal_mp_dmg => "0",
  320.         :ally_mp_dmg => "20 * tcr",
  321.         :deal_state  => "0",
  322.         :gain_state  => "0",
  323.         :kill_ally   => "0",
  324.         :kill_enemy  => "0",
  325.         :win_battle  => "0",
  326.         :flee_battle => "0",
  327.         :lose_battle => "0",
  328.         :low_hp_turn => "0",
  329.         :low_mp_turn => "0",
  330.         :only_alive  => "0",
  331.         :evasion     => "0",
  332.       }, # Do not remove this.
  333.     # -------------------------------------------------------------------------
  334.       5 => { # New TP mode!
  335.       # :setting     => Adjust settings as you see fit.
  336.         :name        => "Alchemist",
  337.         :icon        => 193,
  338.         :description => "Raise TP whenever user recovers MP to an ally.",
  339.         :preserve_tp => true,
  340.         :init_tp     => "0",
  341.         :regen_tp    => "0",
  342.         :take_hp_dmg => "0",
  343.         :deal_hp_dmg => "0",
  344.         :heal_hp_dmg => "0",
  345.         :ally_hp_dmg => "0",
  346.         :take_mp_dmg => "0",
  347.         :deal_mp_dmg => "0",
  348.         :heal_mp_dmg => "[@result.mp_damage / -4, 16].min * tcr",
  349.         :ally_mp_dmg => "0",
  350.         :deal_state  => "0",
  351.         :gain_state  => "0",
  352.         :kill_ally   => "0",
  353.         :kill_enemy  => "0",
  354.         :win_battle  => "0",
  355.         :flee_battle => "0",
  356.         :lose_battle => "0",
  357.         :low_hp_turn => "0",
  358.         :low_mp_turn => "0",
  359.         :only_alive  => "0",
  360.         :evasion     => "0",
  361.       }, # Do not remove this.
  362.     # -------------------------------------------------------------------------
  363.       6 => { # New TP mode!
  364.       # :setting     => Adjust settings as you see fit.
  365.         :name        => "Slayer",
  366.         :icon        => 115,
  367.         :description => "Raise TP whenever an enemy is killed.",
  368.         :preserve_tp => true,
  369.         :init_tp     => "0",
  370.         :regen_tp    => "0",
  371.         :take_hp_dmg => "0",
  372.         :deal_hp_dmg => "0",
  373.         :heal_hp_dmg => "0",
  374.         :ally_hp_dmg => "0",
  375.         :take_mp_dmg => "0",
  376.         :deal_mp_dmg => "0",
  377.         :heal_mp_dmg => "0",
  378.         :ally_mp_dmg => "0",
  379.         :deal_state  => "0",
  380.         :gain_state  => "0",
  381.         :kill_ally   => "0",
  382.         :kill_enemy  => "25 * tcr",
  383.         :win_battle  => "0",
  384.         :flee_battle => "0",
  385.         :lose_battle => "0",
  386.         :low_hp_turn => "0",
  387.         :low_mp_turn => "0",
  388.         :only_alive  => "0",
  389.         :evasion     => "0",
  390.       }, # Do not remove this.
  391.     # -------------------------------------------------------------------------
  392.       7 => { # New TP mode!
  393.       # :setting     => Adjust settings as you see fit.
  394.         :name        => "Avenger",
  395.         :icon        => 1,
  396.         :description => "Raise TP whenever an ally is killed.",
  397.         :preserve_tp => true,
  398.         :init_tp     => "0",
  399.         :regen_tp    => "0",
  400.         :take_hp_dmg => "0",
  401.         :deal_hp_dmg => "0",
  402.         :heal_hp_dmg => "0",
  403.         :ally_hp_dmg => "0",
  404.         :take_mp_dmg => "0",
  405.         :deal_mp_dmg => "0",
  406.         :heal_mp_dmg => "0",
  407.         :ally_mp_dmg => "0",
  408.         :deal_state  => "0",
  409.         :gain_state  => "0",
  410.         :kill_ally   => "50 * tcr",
  411.         :kill_enemy  => "0",
  412.         :win_battle  => "0",
  413.         :flee_battle => "0",
  414.         :lose_battle => "0",
  415.         :low_hp_turn => "0",
  416.         :low_mp_turn => "0",
  417.         :only_alive  => "0",
  418.         :evasion     => "0",
  419.       }, # Do not remove this.
  420.     # -------------------------------------------------------------------------
  421.       8 => { # New TP mode!
  422.       # :setting     => Adjust settings as you see fit.
  423.         :name        => "Victor",
  424.         :icon        => 113,
  425.         :description => "Raise TP whenever your party defeat all enemies.",
  426.         :preserve_tp => true,
  427.         :init_tp     => "0",
  428.         :regen_tp    => "0",
  429.         :take_hp_dmg => "0",
  430.         :deal_hp_dmg => "0",
  431.         :heal_hp_dmg => "0",
  432.         :ally_hp_dmg => "0",
  433.         :take_mp_dmg => "0",
  434.         :deal_mp_dmg => "0",
  435.         :heal_mp_dmg => "0",
  436.         :ally_mp_dmg => "0",
  437.         :deal_state  => "0",
  438.         :gain_state  => "0",
  439.         :kill_ally   => "0",
  440.         :kill_enemy  => "0",
  441.         :win_battle  => "20 * tcr",
  442.         :flee_battle => "0",
  443.         :lose_battle => "0",
  444.         :low_hp_turn => "0",
  445.         :low_mp_turn => "0",
  446.         :only_alive  => "0",
  447.         :evasion     => "0",
  448.       }, # Do not remove this.
  449.     # -------------------------------------------------------------------------
  450.       9 => { # New TP mode!
  451.       # :setting     => Adjust settings as you see fit.
  452.         :name        => "Coward",
  453.         :icon        => 114,
  454.         :description => "Raise TP whenever your party escapes from battle.",
  455.         :preserve_tp => true,
  456.         :init_tp     => "0",
  457.         :regen_tp    => "0",
  458.         :take_hp_dmg => "0",
  459.         :deal_hp_dmg => "0",
  460.         :heal_hp_dmg => "0",
  461.         :ally_hp_dmg => "0",
  462.         :take_mp_dmg => "0",
  463.         :deal_mp_dmg => "0",
  464.         :heal_mp_dmg => "0",
  465.         :ally_mp_dmg => "0",
  466.         :deal_state  => "0",
  467.         :gain_state  => "0",
  468.         :kill_ally   => "0",
  469.         :kill_enemy  => "0",
  470.         :win_battle  => "0",
  471.         :flee_battle => "0",
  472.         :lose_battle => "20 * tcr",
  473.         :low_hp_turn => "0",
  474.         :low_mp_turn => "0",
  475.         :only_alive  => "0",
  476.         :evasion     => "0",
  477.       }, # Do not remove this.
  478.     # -------------------------------------------------------------------------
  479.       10 => { # New TP mode!
  480.       # :setting     => Adjust settings as you see fit.
  481.         :name        => "Daredevil",
  482.         :icon        => 48,
  483.         :description => "Raise TP whenever user ends a turn with low HP.",
  484.         :preserve_tp => true,
  485.         :init_tp     => "0",
  486.         :regen_tp    => "0",
  487.         :take_hp_dmg => "0",
  488.         :deal_hp_dmg => "0",
  489.         :heal_hp_dmg => "0",
  490.         :ally_hp_dmg => "0",
  491.         :take_mp_dmg => "0",
  492.         :deal_mp_dmg => "0",
  493.         :heal_mp_dmg => "0",
  494.         :ally_mp_dmg => "0",
  495.         :deal_state  => "0",
  496.         :gain_state  => "0",
  497.         :kill_ally   => "0",
  498.         :kill_enemy  => "0",
  499.         :win_battle  => "0",
  500.         :flee_battle => "0",
  501.         :lose_battle => "0",
  502.         :low_hp_turn => "16 * tcr",
  503.         :low_mp_turn => "0",
  504.         :only_alive  => "0",
  505.         :evasion     => "0",
  506.       }, # Do not remove this.
  507.     # -------------------------------------------------------------------------
  508.       11 => { # New TP mode!
  509.       # :setting     => Adjust settings as you see fit.
  510.         :name        => "Caster",
  511.         :icon        => 49,
  512.         :description => "Raise TP whenever user ends a turn with low MP.",
  513.         :preserve_tp => true,
  514.         :init_tp     => "0",
  515.         :regen_tp    => "0",
  516.         :take_hp_dmg => "0",
  517.         :deal_hp_dmg => "0",
  518.         :heal_hp_dmg => "0",
  519.         :ally_hp_dmg => "0",
  520.         :take_mp_dmg => "0",
  521.         :deal_mp_dmg => "0",
  522.         :heal_mp_dmg => "0",
  523.         :ally_mp_dmg => "0",
  524.         :deal_state  => "0",
  525.         :gain_state  => "0",
  526.         :kill_ally   => "0",
  527.         :kill_enemy  => "0",
  528.         :win_battle  => "0",
  529.         :flee_battle => "0",
  530.         :lose_battle => "0",
  531.         :low_hp_turn => "0",
  532.         :low_mp_turn => "16 * tcr",
  533.         :only_alive  => "0",
  534.         :evasion     => "0",
  535.       }, # Do not remove this.
  536.     # -------------------------------------------------------------------------
  537.       12 => { # New TP mode!
  538.       # :setting     => Adjust settings as you see fit.
  539.         :name        => "Tactician",
  540.         :icon        => 10,
  541.         :description => "Raise TP whenever user inflicts an ailment on a foe.",
  542.         :preserve_tp => true,
  543.         :init_tp     => "0",
  544.         :regen_tp    => "0",
  545.         :take_hp_dmg => "0",
  546.         :deal_hp_dmg => "0",
  547.         :heal_hp_dmg => "0",
  548.         :ally_hp_dmg => "0",
  549.         :take_mp_dmg => "0",
  550.         :deal_mp_dmg => "0",
  551.         :heal_mp_dmg => "0",
  552.         :ally_mp_dmg => "0",
  553.         :deal_state  => "16 * tcr",
  554.         :gain_state  => "0",
  555.         :kill_ally   => "0",
  556.         :kill_enemy  => "0",
  557.         :win_battle  => "0",
  558.         :flee_battle => "0",
  559.         :lose_battle => "0",
  560.         :low_hp_turn => "0",
  561.         :low_mp_turn => "0",
  562.         :only_alive  => "0",
  563.         :evasion     => "0",
  564.       }, # Do not remove this.
  565.     # -------------------------------------------------------------------------
  566.       13 => { # New TP mode!
  567.       # :setting     => Adjust settings as you see fit.
  568.         :name        => "Sufferer",
  569.         :icon        => 3,
  570.         :description => "Raise TP whenever user receives an ailment from a foe.",
  571.         :preserve_tp => true,
  572.         :init_tp     => "0",
  573.         :regen_tp    => "0",
  574.         :take_hp_dmg => "0",
  575.         :deal_hp_dmg => "0",
  576.         :heal_hp_dmg => "0",
  577.         :ally_hp_dmg => "0",
  578.         :take_mp_dmg => "0",
  579.         :deal_mp_dmg => "0",
  580.         :heal_mp_dmg => "0",
  581.         :ally_mp_dmg => "0",
  582.         :deal_state  => "0",
  583.         :gain_state  => "16 * tcr",
  584.         :kill_ally   => "0",
  585.         :kill_enemy  => "0",
  586.         :win_battle  => "0",
  587.         :flee_battle => "0",
  588.         :lose_battle => "0",
  589.         :low_hp_turn => "0",
  590.         :low_mp_turn => "0",
  591.         :only_alive  => "0",
  592.         :evasion     => "0",
  593.       }, # Do not remove this.
  594.     # -------------------------------------------------------------------------
  595.       14 => { # New TP mode!
  596.       # :setting     => Adjust settings as you see fit.
  597.         :name        => "Dancer",
  598.         :icon        => 12,
  599.         :description => "Raise TP whenever user successfully evades an attack.",
  600.         :preserve_tp => true,
  601.         :init_tp     => "0",
  602.         :regen_tp    => "0",
  603.         :take_hp_dmg => "0",
  604.         :deal_hp_dmg => "0",
  605.         :heal_hp_dmg => "0",
  606.         :ally_hp_dmg => "0",
  607.         :take_mp_dmg => "0",
  608.         :deal_mp_dmg => "0",
  609.         :heal_mp_dmg => "0",
  610.         :ally_mp_dmg => "0",
  611.         :deal_state  => "0",
  612.         :gain_state  => "0",
  613.         :kill_ally   => "0",
  614.         :kill_enemy  => "0",
  615.         :win_battle  => "0",
  616.         :flee_battle => "0",
  617.         :lose_battle => "0",
  618.         :low_hp_turn => "0",
  619.         :low_mp_turn => "0",
  620.         :only_alive  => "0",
  621.         :evasion     => "16 * tcr",
  622.       }, # Do not remove this.
  623.     # -------------------------------------------------------------------------
  624.       15 => { # New TP mode!
  625.       # :setting     => Adjust settings as you see fit.
  626.         :name        => "Loner",
  627.         :icon        => 14,
  628.         :description => "Raise TP whenever user is the last remaining member.",
  629.         :preserve_tp => true,
  630.         :init_tp     => "0",
  631.         :regen_tp    => "0",
  632.         :take_hp_dmg => "0",
  633.         :deal_hp_dmg => "0",
  634.         :heal_hp_dmg => "0",
  635.         :ally_hp_dmg => "0",
  636.         :take_mp_dmg => "0",
  637.         :deal_mp_dmg => "0",
  638.         :heal_mp_dmg => "0",
  639.         :ally_mp_dmg => "0",
  640.         :deal_state  => "0",
  641.         :gain_state  => "0",
  642.         :kill_ally   => "0",
  643.         :kill_enemy  => "0",
  644.         :win_battle  => "0",
  645.         :flee_battle => "0",
  646.         :lose_battle => "0",
  647.         :low_hp_turn => "0",
  648.         :low_mp_turn => "0",
  649.         :only_alive  => "16 * tcr",
  650.         :evasion     => "0",
  651.       }, # Do not remove this.
  652.     # -------------------------------------------------------------------------
  653.     } # Do not remove this.
  654.    
  655.   end # TP_MANAGER
  656. end # YEA
  657.  
  658. #==============================================================================
  659. # ▼ Editting anything past this point may potentially result in causing
  660. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  661. # halitosis so edit at your own risk.
  662. #==============================================================================
  663.  
  664. module YEA
  665.   module REGEXP
  666.   module ACTOR
  667.    
  668.     TP_MODE   = /<(?:TP_MODE|tp mode):[ ](\d+)>/i
  669.     UNLOCK_TP = /<(?:UNLOCK_TP|unlock tp):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  670.    
  671.   end # ACTOR
  672.   module ENEMY
  673.    
  674.     TP_MODE   = /<(?:TP_MODE|tp mode):[ ](\d+)>/i
  675.    
  676.   end # ENEMY
  677.   module BASEITEM
  678.    
  679.     UNLOCK_TP = /<(?:UNLOCK_TP|unlock tp):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  680.     LEARN_TP = /<(?:LEARN_UNLOCK_TP|learn unlock tp):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  681.     TP_COST  = /<(?:TP_COST|tp cost):[ ](\d+)>/i
  682.    
  683.   end # BASEITEM
  684.   end # REGEXP
  685. end # YEA
  686.  
  687. #==============================================================================
  688. # ■ Switch
  689. #==============================================================================
  690.  
  691. module Switch
  692.  
  693.   #--------------------------------------------------------------------------
  694.   # self.tp_mode
  695.   #--------------------------------------------------------------------------
  696.   def self.tp_mode
  697.     return true if YEA::TP_MANAGER::TP_MODE_SWITCH <= 0
  698.     return $game_switches[YEA::TP_MANAGER::TP_MODE_SWITCH]
  699.   end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # self.tp_mode_set
  703.   #--------------------------------------------------------------------------
  704.   def self.tp_mode_set(item)
  705.     return if YEA::TP_MANAGER::TP_MODE_SWITCH <= 0
  706.     $game_switches[YEA::TP_MANAGER::TP_MODE_SWITCH] = item
  707.   end
  708.    
  709. end # Switch
  710.  
  711. #==============================================================================
  712. # ■ Numeric
  713. #==============================================================================
  714.  
  715. class Numeric
  716.  
  717.   #--------------------------------------------------------------------------
  718.   # new method: group_digits
  719.   #--------------------------------------------------------------------------
  720.   unless $imported["YEA-CoreEngine"]
  721.   def group; return self.to_s; end
  722.   end # $imported["YEA-CoreEngine"]
  723.    
  724. end # Numeric
  725.  
  726. #==============================================================================
  727. # ■ DataManager
  728. #==============================================================================
  729.  
  730. module DataManager
  731.  
  732.   #--------------------------------------------------------------------------
  733.   # alias method: load_database
  734.   #--------------------------------------------------------------------------
  735.   class <<self; alias load_database_tpm load_database; end
  736.   def self.load_database
  737.     load_database_tpm
  738.     load_notetags_tpm
  739.   end
  740.  
  741.   #--------------------------------------------------------------------------
  742.   # new method: load_notetags_tpm
  743.   #--------------------------------------------------------------------------
  744.   def self.load_notetags_tpm
  745.     groups = [$data_actors, $data_enemies, $data_items, $data_skills]
  746.     for group in groups
  747.       for obj in group
  748.         next if obj.nil?
  749.         obj.load_notetags_tpm
  750.       end
  751.     end
  752.   end
  753.  
  754.   #--------------------------------------------------------------------------
  755.   # alias method: setup_new_game
  756.   #--------------------------------------------------------------------------
  757.   class <<self; alias setup_new_game_tpm setup_new_game; end
  758.   def self.setup_new_game
  759.     setup_new_game_tpm
  760.     Switch.tp_mode_set(YEA::TP_MANAGER::DEFAULT_ENABLE)
  761.   end
  762.  
  763. end # DataManager
  764.  
  765. #==============================================================================
  766. # ■ RPG::Actor
  767. #==============================================================================
  768.  
  769. class RPG::Actor < RPG::BaseItem
  770.  
  771.   #--------------------------------------------------------------------------
  772.   # public instance variables
  773.   #--------------------------------------------------------------------------
  774.   attr_accessor :tp_mode
  775.   attr_accessor :unlocked_tp_modes
  776.  
  777.   #--------------------------------------------------------------------------
  778.   # common cache: load_notetags_tpm
  779.   #--------------------------------------------------------------------------
  780.   def load_notetags_tpm
  781.     @tp_mode = nil
  782.     @unlocked_tp_modes = []
  783.     #---
  784.     self.note.split(/[\r\n]+/).each { |line|
  785.       case line
  786.       #---
  787.       when YEA::REGEXP::ACTOR::TP_MODE
  788.         @tp_mode = $1.to_i
  789.       when YEA::REGEXP::ACTOR::UNLOCK_TP
  790.         $1.scan(/\d+/).each { |num|
  791.         @unlocked_tp_modes.push(num.to_i) if num.to_i >= 0 }
  792.       #---
  793.       end
  794.     } # self.note.split
  795.     #---
  796.     @tp_mode = YEA::TP_MANAGER::DEFAULT_TP_MODE if @tp_mode.nil?
  797.     if @unlocked_tp_modes.empty?
  798.       @unlocked_tp_modes = YEA::TP_MANAGER::DEFAULT_UNLOCKS.clone
  799.     end
  800.     @unlocked_tp_modes.push(@tp_mode) if !@unlocked_tp_modes.include?(@tp_mode)
  801.     @unlocked_tp_modes.uniq!
  802.     @unlocked_tp_modes.sort!
  803.   end
  804.  
  805. end # RPG::Actor
  806.  
  807. #==============================================================================
  808. # ■ RPG::Enemy
  809. #==============================================================================
  810.  
  811. class RPG::Enemy < RPG::BaseItem
  812.  
  813.   #--------------------------------------------------------------------------
  814.   # public instance variables
  815.   #--------------------------------------------------------------------------
  816.   attr_accessor :tp_mode
  817.  
  818.   #--------------------------------------------------------------------------
  819.   # common cache: load_notetags_tpm
  820.   #--------------------------------------------------------------------------
  821.   def load_notetags_tpm
  822.     @tp_mode = YEA::TP_MANAGER::DEFAULT_TP_MODE
  823.     #---
  824.     self.note.split(/[\r\n]+/).each { |line|
  825.       case line
  826.       #---
  827.       when YEA::REGEXP::ENEMY::TP_MODE
  828.         @tp_mode = $1.to_i
  829.       #---
  830.       end
  831.     } # self.note.split
  832.     #---
  833.   end
  834.  
  835. end # RPG::Enemy
  836.  
  837. #==============================================================================
  838. # ■ RPG::BaseItem
  839. #==============================================================================
  840.  
  841. class RPG::BaseItem
  842.  
  843.   #--------------------------------------------------------------------------
  844.   # public instance variables
  845.   #--------------------------------------------------------------------------
  846.   attr_accessor :unlocked_tp_modes
  847.   attr_accessor :learn_tp_modes
  848.   attr_accessor :tp_cost
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # common cache: load_notetags_tpm
  852.   #--------------------------------------------------------------------------
  853.   def load_notetags_tpm
  854.     @unlocked_tp_modes = []
  855.     @learn_tp_modes = []
  856.     #---
  857.     self.note.split(/[\r\n]+/).each { |line|
  858.       case line
  859.       #---
  860.       when YEA::REGEXP::BASEITEM::UNLOCK_TP
  861.         $1.scan(/\d+/).each { |num|
  862.         @unlocked_tp_modes.push(num.to_i) if num.to_i > 0 }
  863.       when YEA::REGEXP::BASEITEM::LEARN_TP
  864.         $1.scan(/\d+/).each { |num|
  865.         @learn_tp_modes.push(num.to_i) if num.to_i > 0 }
  866.       when YEA::REGEXP::BASEITEM::TP_COST
  867.         next unless self.is_a?(RPG::Skill)
  868.         @tp_cost = $1.to_i
  869.       #---
  870.       end
  871.     } # self.note.split
  872.     #---
  873.   end
  874.  
  875. end # RPG::BaseItem
  876.  
  877. #==============================================================================
  878. # ■ BattleManager
  879. #==============================================================================
  880.  
  881. module BattleManager
  882.  
  883.   #--------------------------------------------------------------------------
  884.   # alias method: load_database
  885.   #--------------------------------------------------------------------------
  886.   class <<self; alias battle_end_tpm battle_end; end
  887.   def self.battle_end(result)
  888.     battle_end_tpm(result)
  889.     case result
  890.     when 0
  891.       for member in $game_party.alive_members
  892.         member.tp += eval(member.tp_setting(:win_battle))
  893.       end
  894.     when 1
  895.       for member in $game_party.alive_members
  896.         member.tp += eval(member.tp_setting(:flee_battle))
  897.       end
  898.     end
  899.   end
  900.  
  901. end # BattleManager
  902.  
  903. #==============================================================================
  904. # ■ Game_BattlerBase
  905. #==============================================================================
  906.  
  907. class Game_BattlerBase
  908.  
  909.   #--------------------------------------------------------------------------
  910.   # public instance variables
  911.   #--------------------------------------------------------------------------
  912.   attr_accessor :tp_mode
  913.   attr_accessor :unlocked_tp_modes
  914.  
  915.   #--------------------------------------------------------------------------
  916.   # overwrite method: max_tp
  917.   #--------------------------------------------------------------------------
  918.   def max_tp; return YEA::TP_MANAGER::TP_LIMIT; end
  919.  
  920.   #--------------------------------------------------------------------------
  921.   # anti-crash methods: max_tp, unlocked_tp_modes
  922.   #--------------------------------------------------------------------------
  923.   def tp_mode; return 0; end
  924.   def unlocked_tp_modes; return [0]; end
  925.  
  926.   #--------------------------------------------------------------------------
  927.   # new method: tp_setting
  928.   #--------------------------------------------------------------------------
  929.   def tp_setting(setting)
  930.     return YEA::TP_MANAGER::TP_MODES[tp_mode][setting]
  931.   end
  932.  
  933.   #--------------------------------------------------------------------------
  934.   # alias method: preserve_tp?
  935.   #--------------------------------------------------------------------------
  936.   alias game_battlerbase_preserve_tp_tpm preserve_tp?
  937.   def preserve_tp?
  938.     return true if tp_setting(:preserve_tp)
  939.     return game_battlerbase_preserve_tp_tpm
  940.   end
  941.  
  942. end # Game_BattlerBase
  943.  
  944. #==============================================================================
  945. # ■ Game_Battler
  946. #==============================================================================
  947.  
  948. class Game_Battler < Game_BattlerBase
  949.  
  950.   #--------------------------------------------------------------------------
  951.   # overwrite method: init_tp
  952.   #--------------------------------------------------------------------------
  953.   def init_tp
  954.     self.tp = eval(tp_setting(:init_tp))
  955.   end
  956.  
  957.   #--------------------------------------------------------------------------
  958.   # overwrite method: charge_tp_by_damage
  959.   #--------------------------------------------------------------------------
  960.   def charge_tp_by_damage(damage_rate)
  961.     self.tp += eval(tp_setting(:take_hp_dmg))
  962.   end
  963.  
  964.   #--------------------------------------------------------------------------
  965.   # new method: charge_tp_by_mp_damage
  966.   #--------------------------------------------------------------------------
  967.   def charge_tp_by_mp_damage(damage_rate)
  968.     self.tp += eval(tp_setting(:take_mp_dmg))
  969.   end
  970.  
  971.   #--------------------------------------------------------------------------
  972.   # overwrite method:
  973.   #--------------------------------------------------------------------------
  974.   def regenerate_tp
  975.     self.tp += eval(tp_setting(:regen_tp))
  976.     self.tp += eval(tp_setting(:low_hp_turn)) if self.hp < tp_low_hp
  977.     self.tp += eval(tp_setting(:low_mp_turn)) if self.mp < tp_low_mp
  978.     if friends_unit.alive_members.size == 1
  979.       self.tp += eval(tp_setting(:only_alive))
  980.     end
  981.   end
  982.  
  983.   #--------------------------------------------------------------------------
  984.   # new method: tp_low_hp
  985.   #--------------------------------------------------------------------------
  986.   def tp_low_hp
  987.     return self.mhp * YEA::TP_MANAGER::LOW_HP
  988.   end
  989.  
  990.   #--------------------------------------------------------------------------
  991.   # new method: tp_low_mp
  992.   #--------------------------------------------------------------------------
  993.   def tp_low_mp
  994.     return self.mmp * YEA::TP_MANAGER::LOW_MP
  995.   end
  996.  
  997.   #--------------------------------------------------------------------------
  998.   # alias method: execute_damage
  999.   #--------------------------------------------------------------------------
  1000.   alias game_battler_execute_damage_tpm execute_damage
  1001.   def execute_damage(user)
  1002.     game_battler_execute_damage_tpm(user)
  1003.     return unless $game_party.in_battle
  1004.     @result.restore_damage if $imported["YEA-BattleEngine"]
  1005.     if @result.hp_damage > 0
  1006.       user.tp += eval(user.tp_setting(:deal_hp_dmg))
  1007.       gain_tp_ally_hp_damage
  1008.     elsif @result.hp_damage < 0
  1009.       user.tp += eval(user.tp_setting(:heal_hp_dmg))
  1010.     end
  1011.     if @result.mp_damage > 0
  1012.       user.tp += eval(user.tp_setting(:deal_mp_dmg))
  1013.       gain_tp_ally_mp_damage
  1014.       charge_tp_by_mp_damage(@result.mp_damage)
  1015.     elsif @result.mp_damage < 0
  1016.       user.tp += eval(user.tp_setting(:heal_mp_dmg))
  1017.     end
  1018.     user.tp += eval(user.tp_setting(:kill_enemy)) if self.hp == 0
  1019.     gain_tp_kill_ally if self.hp == 0
  1020.     return unless $imported["YEA-BattleEngine"]
  1021.     @result.store_damage
  1022.     @result.clear_damage_values
  1023.   end
  1024.  
  1025.   #--------------------------------------------------------------------------
  1026.   # alias method: item_effect_recover_hp
  1027.   #--------------------------------------------------------------------------
  1028.   alias game_battler_item_effect_recover_hp_tpm item_effect_recover_hp
  1029.   def item_effect_recover_hp(user, item, effect)
  1030.     game_battler_item_effect_recover_hp_tpm(user, item, effect)
  1031.     return unless $game_party.in_battle
  1032.     @result.restore_damage if $imported["YEA-BattleEngine"]
  1033.     if @result.hp_damage > 0
  1034.       user.tp += eval(user.tp_setting(:deal_hp_dmg))
  1035.       gain_tp_ally_hp_damage
  1036.     elsif @result.hp_damage < 0
  1037.       user.tp += eval(user.tp_setting(:heal_hp_dmg))
  1038.     end
  1039.     return unless $imported["YEA-BattleEngine"]
  1040.     @result.store_damage
  1041.     @result.clear_damage_values
  1042.   end
  1043.  
  1044.   #--------------------------------------------------------------------------
  1045.   # alias method: item_effect_recover_mp
  1046.   #--------------------------------------------------------------------------
  1047.   alias game_battler_item_effect_recover_mp_tpm item_effect_recover_mp
  1048.   def item_effect_recover_mp(user, item, effect)
  1049.     game_battler_item_effect_recover_mp_tpm(user, item, effect)
  1050.     return unless $game_party.in_battle
  1051.     @result.restore_damage if $imported["YEA-BattleEngine"]
  1052.     if @result.mp_damage > 0
  1053.       user.tp += eval(user.tp_setting(:deal_mp_dmg))
  1054.       gain_tp_ally_mp_damage
  1055.       charge_tp_by_mp_damage(@result.mp_damage)
  1056.     elsif @result.mp_damage < 0
  1057.       user.tp += eval(user.tp_setting(:heal_mp_dmg))
  1058.     end
  1059.     return unless $imported["YEA-BattleEngine"]
  1060.     @result.store_damage
  1061.     @result.clear_damage_values
  1062.   end
  1063.  
  1064.   #--------------------------------------------------------------------------
  1065.   # new method: gain_tp_ally_hp_damage
  1066.   #--------------------------------------------------------------------------
  1067.   def gain_tp_ally_hp_damage
  1068.     for member in friends_unit.alive_members
  1069.       next if member == self
  1070.       member.tp += eval(member.tp_setting(:ally_hp_dmg))
  1071.     end
  1072.   end
  1073.  
  1074.   #--------------------------------------------------------------------------
  1075.   # new method: gain_tp_ally_mp_damage
  1076.   #--------------------------------------------------------------------------
  1077.   def gain_tp_ally_mp_damage
  1078.     for member in friends_unit.alive_members
  1079.       next if member == self
  1080.       member.tp += eval(member.tp_setting(:ally_mp_dmg))
  1081.     end
  1082.   end
  1083.  
  1084.   #--------------------------------------------------------------------------
  1085.   # new method: gain_tp_kill_ally
  1086.   #--------------------------------------------------------------------------
  1087.   def gain_tp_kill_ally
  1088.     for member in friends_unit.alive_members
  1089.       next if member == self
  1090.       member.tp += eval(member.tp_setting(:kill_ally))
  1091.     end
  1092.   end
  1093.  
  1094.   #--------------------------------------------------------------------------
  1095.   # alias method: item_effect_add_state
  1096.   #--------------------------------------------------------------------------
  1097.   alias game_battler_item_effect_add_state_tpm item_effect_add_state
  1098.   def item_effect_add_state(user, item, effect)
  1099.     original_states = states.clone
  1100.     game_battler_item_effect_add_state_tpm(user, item, effect)
  1101.     return unless $game_party.in_battle
  1102.     if original_states != states && opponents_unit.members.include?(user)
  1103.       user.tp += eval(user.tp_setting(:deal_state))
  1104.       self.tp += eval(tp_setting(:gain_state))
  1105.     end
  1106.   end
  1107.  
  1108.   #--------------------------------------------------------------------------
  1109.   # alias method: item_apply
  1110.   #--------------------------------------------------------------------------
  1111.   alias game_battler_item_apply_tpm item_apply
  1112.   def item_apply(user, item)
  1113.     game_battler_item_apply_tpm(user, item)
  1114.     return unless $game_party.in_battle
  1115.     return if @result.hit?
  1116.     self.tp += eval(tp_setting(:evasion))
  1117.   end
  1118.  
  1119.   #--------------------------------------------------------------------------
  1120.   # alias method: item_test
  1121.   #--------------------------------------------------------------------------
  1122.   alias game_battler_item_test_tpm item_test
  1123.   def item_test(user, item)
  1124.     return false if item.for_dead_friend? != dead?
  1125.     return true if item.unlocked_tp_modes.size > 0
  1126.     return game_battler_item_test_tpm(user, item)
  1127.   end
  1128.  
  1129.   #--------------------------------------------------------------------------
  1130.   # alias method: item_user_effect
  1131.   #--------------------------------------------------------------------------
  1132.   alias game_battler_item_user_effect_tpm item_user_effect
  1133.   def item_user_effect(user, item)
  1134.     game_battler_item_user_effect_tpm(user, item)
  1135.     return unless actor?
  1136.     for mode in item.unlocked_tp_modes
  1137.       unlock_tp_mode(mode)
  1138.     end
  1139.   end
  1140.  
  1141. end # Game_Battler
  1142.  
  1143. #==============================================================================
  1144. # ■ Game_Actor
  1145. #==============================================================================
  1146.  
  1147. class Game_Actor < Game_Battler
  1148.  
  1149.   #--------------------------------------------------------------------------
  1150.   # alias method: setup
  1151.   #--------------------------------------------------------------------------
  1152.   alias game_actor_setup_tpm setup
  1153.   def setup(actor_id)
  1154.     game_actor_setup_tpm(actor_id)
  1155.     @tp_mode = actor.tp_mode
  1156.     @unlocked_tp_modes = actor.unlocked_tp_modes.clone
  1157.   end
  1158.  
  1159.   #--------------------------------------------------------------------------
  1160.   # new method: tp_mode
  1161.   #--------------------------------------------------------------------------
  1162.   def tp_mode
  1163.     @tp_mode = actor.tp_mode if @tp_mode.nil?
  1164.     return @tp_mode
  1165.   end
  1166.  
  1167.   #--------------------------------------------------------------------------
  1168.   # new method: unlocked_tp_modes
  1169.   #--------------------------------------------------------------------------
  1170.   def unlocked_tp_modes
  1171.     if @unlocked_tp_modes.empty?
  1172.       @unlocked_tp_modes = actor.unlocked_tp_modes.clone
  1173.     end
  1174.     return @unlocked_tp_modes.uniq
  1175.   end
  1176.  
  1177.   #--------------------------------------------------------------------------
  1178.   # new method: change_tp_mode
  1179.   #--------------------------------------------------------------------------
  1180.   def change_tp_mode(mode)
  1181.     @tp_mode = mode
  1182.     unlock_tp_mode(mode)
  1183.     self.tp = 0 if YEA::TP_MANAGER::CHANGE_TP_RESET
  1184.   end
  1185.  
  1186.   #--------------------------------------------------------------------------
  1187.   # new method: unlock_tp_mode
  1188.   #--------------------------------------------------------------------------
  1189.   def unlock_tp_mode(mode)
  1190.     if @unlocked_tp_modes.empty?
  1191.       @unlocked_tp_modes = actor.unlocked_tp_modes.clone
  1192.     end
  1193.     @unlocked_tp_modes.push(mode)
  1194.     @unlocked_tp_modes.uniq!
  1195.     @unlocked_tp_modes.sort!
  1196.   end
  1197.  
  1198.   #--------------------------------------------------------------------------
  1199.   # new method: remove_tp_mode
  1200.   #--------------------------------------------------------------------------
  1201.   def remove_tp_mode(mode)
  1202.     if @unlocked_tp_modes.empty?
  1203.       @unlocked_tp_modes = actor.unlocked_tp_modes.clone
  1204.     end
  1205.     @unlocked_tp_modes.delete(mode)
  1206.     @tp_mode = @unlocked_tp_modes[0] if @tp_mode == mode
  1207.   end
  1208.  
  1209.   #--------------------------------------------------------------------------
  1210.   # alias method: learn_skill
  1211.   #--------------------------------------------------------------------------
  1212.   alias game_actor_learn_skill_tpm learn_skill
  1213.   def learn_skill(skill_id)
  1214.     game_actor_learn_skill_tpm(skill_id)
  1215.     for mode in $data_skills[skill_id].learn_tp_modes
  1216.       unlock_tp_mode(mode)
  1217.     end
  1218.   end
  1219.  
  1220. end # Game_Actor
  1221.  
  1222. #==============================================================================
  1223. # ■ Game_Enemy
  1224. #==============================================================================
  1225.  
  1226. class Game_Enemy < Game_Battler
  1227.  
  1228.   #--------------------------------------------------------------------------
  1229.   # new method: tp_mode
  1230.   #--------------------------------------------------------------------------
  1231.   def tp_mode; return enemy.tp_mode; end
  1232.  
  1233. end # Game_Enemy
  1234.  
  1235. #==============================================================================
  1236. # ■ Game_Interpreter
  1237. #==============================================================================
  1238.  
  1239. class Game_Interpreter
  1240.  
  1241.   #--------------------------------------------------------------------------
  1242.   # new method: change_tp_mode
  1243.   #--------------------------------------------------------------------------
  1244.   def change_tp_mode(actor_id, mode)
  1245.     $game_actors[actor_id].change_tp_mode(mode)
  1246.   end
  1247.  
  1248.   #--------------------------------------------------------------------------
  1249.   # new method: unlock_tp_mode
  1250.   #--------------------------------------------------------------------------
  1251.   def unlock_tp_mode(actor_id, mode)
  1252.     $game_actors[actor_id].unlock_tp_mode(mode)
  1253.   end
  1254.  
  1255.   #--------------------------------------------------------------------------
  1256.   # new method: remove_tp_mode
  1257.   #--------------------------------------------------------------------------
  1258.   def remove_tp_mode(actor_id, mode)
  1259.     $game_actors[actor_id].remove_tp_mode(mode)
  1260.   end
  1261.  
  1262.   #--------------------------------------------------------------------------
  1263.   # new method: unlock_all_tp_modes
  1264.   #--------------------------------------------------------------------------
  1265.   def unlock_all_tp_modes(actor_id)
  1266.     for key in YEA::TP_MANAGER::TP_MODES
  1267.       $game_actors[actor_id].unlock_tp_mode(key[0])
  1268.     end
  1269.   end
  1270.  
  1271.   #--------------------------------------------------------------------------
  1272.   # new method: remove_all_tp_modes
  1273.   #--------------------------------------------------------------------------
  1274.   def remove_all_tp_modes(actor_id)
  1275.     for key in YEA::TP_MANAGER::TP_MODES
  1276.       next if key[0] == $data_actors[actor_id].tp_mode
  1277.       $game_actors[actor_id].remove_tp_mode(key[0])
  1278.     end
  1279.   end
  1280.  
  1281. end # Game_Interpreter
  1282.  
  1283. #==============================================================================
  1284. # ■ Window_SkillCommand
  1285. #==============================================================================
  1286.  
  1287. class Window_SkillCommand < Window_Command
  1288.  
  1289.   #--------------------------------------------------------------------------
  1290.   # alias method: make_command_list
  1291.   #--------------------------------------------------------------------------
  1292.   alias window_skillcommand_make_command_list_tpm make_command_list
  1293.   def make_command_list
  1294.     return unless @actor
  1295.     window_skillcommand_make_command_list_tpm
  1296.     return if $imported["YEA-SkillMenu"]
  1297.     add_tp_modes
  1298.   end
  1299.  
  1300.   #--------------------------------------------------------------------------
  1301.   # new method: add_tp_modes
  1302.   #--------------------------------------------------------------------------
  1303.   def add_tp_modes
  1304.     return unless Switch.tp_mode
  1305.     return unless SceneManager.scene_is?(Scene_Skill)
  1306.     add_command(YEA::TP_MANAGER::MENU_NAME, :tp_mode, true, :tp_mode)
  1307.   end
  1308.  
  1309. end # Window_SkillCommand
  1310.  
  1311. #==============================================================================
  1312. # ■ Window_SkillList
  1313. #==============================================================================
  1314.  
  1315. class Window_SkillList < Window_Selectable
  1316.  
  1317.   #--------------------------------------------------------------------------
  1318.   # new method: tp_mode?
  1319.   #--------------------------------------------------------------------------
  1320.   def tp_mode?; return @stype_id == :tp_mode; end
  1321.  
  1322.   #--------------------------------------------------------------------------
  1323.   # new method: tp_mode
  1324.   #--------------------------------------------------------------------------
  1325.   def tp_mode
  1326.     return nil unless tp_mode?
  1327.     return @data[index]
  1328.   end
  1329.  
  1330.   #--------------------------------------------------------------------------
  1331.   # alias method: make_item_list
  1332.   #--------------------------------------------------------------------------
  1333.   alias window_skilllist_make_item_list_tpm make_item_list
  1334.   def make_item_list
  1335.     if tp_mode?
  1336.       @data = @actor.unlocked_tp_modes
  1337.       @data.sort!
  1338.     else
  1339.       window_skilllist_make_item_list_tpm
  1340.     end
  1341.   end
  1342.  
  1343.   #--------------------------------------------------------------------------
  1344.   # alias method: draw_item
  1345.   #--------------------------------------------------------------------------
  1346.   alias window_skilllist_draw_item_tpm draw_item
  1347.   def draw_item(index)
  1348.     if tp_mode?
  1349.       draw_tp_mode_item(index)
  1350.     else
  1351.       window_skilllist_draw_item_tpm(index)
  1352.     end
  1353.   end
  1354.  
  1355.   #--------------------------------------------------------------------------
  1356.   # new method: draw_tp_mode_item
  1357.   #--------------------------------------------------------------------------
  1358.   def draw_tp_mode_item(index)
  1359.     tp_mode = @data[index]
  1360.     return unless YEA::TP_MANAGER::TP_MODES.include?(tp_mode)
  1361.     rect = item_rect(index)
  1362.     rect.width -= 4
  1363.     icon = YEA::TP_MANAGER::TP_MODES[tp_mode][:icon]
  1364.     draw_icon(icon, rect.x, rect.y)
  1365.     change_color(tp_mode_colour(tp_mode))
  1366.     name = YEA::TP_MANAGER::TP_MODES[tp_mode][:name]
  1367.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, name)
  1368.   end
  1369.  
  1370.   #--------------------------------------------------------------------------
  1371.   # new method: tp_mode_colour
  1372.   #--------------------------------------------------------------------------
  1373.   def tp_mode_colour(mode)
  1374.     if @actor.tp_mode == mode
  1375.       return text_color(YEA::TP_MANAGER::EQUIPPED_COLOUR)
  1376.     else
  1377.       return normal_color
  1378.     end
  1379.   end
  1380.  
  1381.   #--------------------------------------------------------------------------
  1382.   # alias method: current_item_enabled?
  1383.   #--------------------------------------------------------------------------
  1384.   alias window_skilllist_current_item_enabled current_item_enabled?
  1385.   def current_item_enabled?
  1386.     if tp_mode?
  1387.       return @actor.tp_mode != @data[index]
  1388.     else
  1389.       return window_skilllist_current_item_enabled
  1390.     end
  1391.   end
  1392.  
  1393.   #--------------------------------------------------------------------------
  1394.   # alias method: update_help
  1395.   #--------------------------------------------------------------------------
  1396.   alias window_skilllist_update_help_tpm update_help
  1397.   def update_help
  1398.     if tp_mode?
  1399.       tp_mode = @data[index]
  1400.       if YEA::TP_MANAGER::TP_MODES.include?(tp_mode)
  1401.         text = YEA::TP_MANAGER::TP_MODES[tp_mode][:description]
  1402.       else
  1403.         text = ""
  1404.       end
  1405.       @help_window.set_text(text)
  1406.     else
  1407.       window_skilllist_update_help_tpm
  1408.     end
  1409.   end
  1410.  
  1411. end # Window_SkillList
  1412.  
  1413. #==============================================================================
  1414. # ■ Scene_Skill
  1415. #==============================================================================
  1416.  
  1417. class Scene_Skill < Scene_ItemBase
  1418.  
  1419.   #--------------------------------------------------------------------------
  1420.   # alias method: create_command_window
  1421.   #--------------------------------------------------------------------------
  1422.   alias scene_skill_create_command_window_tpm create_command_window
  1423.   def create_command_window
  1424.     scene_skill_create_command_window_tpm
  1425.     @command_window.set_handler(:tp_mode,    method(:command_skill))
  1426.   end
  1427.  
  1428.   #--------------------------------------------------------------------------
  1429.   # alias method: on_item_ok
  1430.   #--------------------------------------------------------------------------
  1431.   alias scene_skill_on_item_ok_tpm on_item_ok
  1432.   def on_item_ok
  1433.     if @item_window.tp_mode?
  1434.       Sound.play_equip
  1435.       user.change_tp_mode(@item_window.tp_mode)
  1436.       @status_window.refresh
  1437.       @item_window.refresh
  1438.       @item_window.activate
  1439.     else
  1440.       scene_skill_on_item_ok_tpm
  1441.     end
  1442.   end
  1443.  
  1444. end # Scene_Skill
  1445.  
  1446. #==============================================================================
  1447. #
  1448. # ▼ End of File
  1449. #
  1450. #==============================================================================
RAW Paste Data