shadowm

Untitled

Feb 23rd, 2013
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.86 KB | None | 0 0
  1. [event]
  2. name=combo controller
  3. first_time_only=no
  4.  
  5. # Pseudo-references to keep code tidy.
  6.  
  7. {VARIABLE rs_a combo_status.side_a}
  8. {VARIABLE rs_b combo_status.side_b}
  9.  
  10. {BUG_ON (
  11. [not]
  12. {VARIABLE_NUMERICAL_EQUALS $rs_a|.target.x $x2}
  13. {VARIABLE_NUMERICAL_EQUALS $rs_a|.target.y $y2}
  14. {VARIABLE_NUMERICAL_EQUALS $rs_b|.target.x $x2}
  15. {VARIABLE_NUMERICAL_EQUALS $rs_b|.target.y $y2}
  16. [/not]
  17. ) ("Combo controller invoked with bad target")}
  18.  
  19. {FOREACH combo_attacks n}
  20. # More pseudo-references
  21. {VARIABLE rc_combo combo_attacks[$n]}
  22.  
  23. {BUG_ON ({VARIABLE_NUMERICAL_NOT_EQUALS $rc_combo|.effect.length 1}) ("Combo effect count in config is not 1 ($$rc_combo|.effect.length)")}
  24.  
  25. {VARIABLE rc_effect $rc_combo|.effect}
  26.  
  27. [if]
  28. {FALSE}
  29.  
  30. # Condition 1: symmetric combos
  31. [or]
  32. {VARIABLE_BOOLEAN_EQUALS $rc_combo|.symmetric yes}
  33. [and] # A = A/B
  34. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_a $$rs_a|.attack}
  35. [or]
  36. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_a $$rs_b|.attack}
  37. [/or]
  38. [/and]
  39. [and] # B = A/B
  40. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_b $$rs_a|.attack}
  41. [or]
  42. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_b $$rs_b|.attack}
  43. [/or]
  44. [/and]
  45. [/or]
  46.  
  47. # Condition 2: asymmetric combos
  48. [or]
  49. {VARIABLE_BOOLEAN_EQUALS $rc_combo|.symmetric no}
  50. # A = A
  51. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_a $$rs_a|.attack}
  52. # B = B
  53. {VARIABLE_LEXICAL_EQUALS $rc_combo|.side_b $$rs_b|.attack}
  54. [/or]
  55.  
  56. [then]
  57. {COMBO_DBG "selected combo [$n]; side a = $$rs_a|.attack; side b = $$rs_b|.attack"}
  58.  
  59. # Apply the combo to the selected attack, then break the loop
  60. {FOREACH unit.attack m}
  61. [if]
  62. {VARIABLE_LEXICAL_EQUALS unit.attack[$m].name $$rs_b|.attack}
  63. [then]
  64. {COMBO_DBG "applying combo effects to attack [$m] '$$rs_b|.attack' on $unit.id"}
  65.  
  66. [if]
  67. {VARIABLE_LEXICAL_EQUALS $rc_effect|.apply_to damage}
  68. [then]
  69. {VARIABLE ra_damage_ary "unit.attack[$m].specials.damage"}
  70. {VARIABLE ra_damage "$ra_damage_ary|[$$ra_damage_ary|.length]"}
  71.  
  72. [set_variables]
  73. name=$ra_damage
  74. mode=insert
  75. [insert_tag]
  76. name=value
  77. variable=$rc_effect
  78. [/insert_tag]
  79. [/set_variables]
  80.  
  81. [set_variables]
  82. name=$ra_damage
  83. mode=merge
  84. [value]
  85. id=combo_damage_effect
  86. apply_to=self
  87. active_on=offense
  88. [/value]
  89. [/set_variables]
  90.  
  91. #{COMBO_DBG "$ra_damage|.id = $$ra_damage|.id"}
  92. #{COMBO_DBG "$ra_damage|.multiply = $$ra_damage|.multiply"}
  93. #{COMBO_DBG "$ra_damage|.apply_to = $$ra_damage|.apply_to"}
  94. #{COMBO_DBG "$ra_damage|.active_on = $$ra_damage|.active_on"}
  95.  
  96. [unstore_unit]
  97. variable=unit
  98. find_vacant=no
  99. [/unstore_unit]
  100.  
  101. [event]
  102. id=combo_hits_handler
  103. name=attacker hits
  104. delayed_variable_substitution=no
  105. first_time_only=yes
  106.  
  107. {UNIT_SPELL_POPUP x,y=$|x1,$|y1 $$rc_combo|.name}
  108. [/event]
  109.  
  110. [event]
  111. name=attack end
  112. delayed_variable_substitution=no
  113. first_time_only=yes
  114.  
  115. {COMBO_DBG "removing combo effects"}
  116.  
  117. {CLEAR_VARIABLE $ra_damage}
  118.  
  119. [unstore_unit]
  120. variable=unit
  121. find_vacant=no
  122. [/unstore_unit]
  123.  
  124. [fire_event]
  125. name=reset combo status
  126. [/fire_event]
  127.  
  128. [event]
  129. id=combo_hits_handler
  130. remove=yes
  131. [/event]
  132. [/event]
  133.  
  134. {CLEAR_VARIABLE ra_damage,ra_damage_ary}
  135.  
  136. {BREAK m}
  137. [/then]
  138. [else]
  139. {BUG ("Combo effect not implemented yet: '$$rc_effect|.apply_to'")}
  140. [/else]
  141. [/if]
  142. [/then]
  143. [/if]
  144. {NEXT m}
  145.  
  146. {BREAK n}
  147. [/then]
  148. [/if]
  149.  
  150. {CLEAR_VARIABLE rc_combo,rc_effect}
  151. {NEXT n}
  152.  
  153. {CLEAR_VARIABLE rs_a,rs_b}
  154. [/event]
Advertisement
Add Comment
Please, Sign In to add comment