Advertisement
madmenyo

Ability data XML

Mar 24th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 7.62 KB | None | 0 0
  1.     <ability name="Attack">
  2.         <range>weapon_range</range>
  3.  
  4.         <AI><!-- for AI to decide what to do -->
  5.             <abilityType>
  6.                 <type>MELEE</type>
  7.                 <type>SINGLE_TARGET</type>
  8.                 <type>DAMAGE</type>
  9.             </abilityType>
  10.         </AI>
  11.  
  12.         <behaviors> <!-- how ability behaves -->
  13.             <behavior>CREATURE_TARGET</behavior>
  14.             <behavior>ATTACK</behavior>
  15.             <behavior>HIDDEN</behavior>
  16.         </behaviors>
  17.  
  18.         <requirements> <!-- what is needed to use this -->
  19.             <requirement>MELEE_WEAPON</requirement>
  20.         </requirements>
  21.  
  22.         <tickCost>WeaponSpeed</tickCost> <!-- time cost -->
  23.         <cooldown>0</cooldown>
  24.         <manaCost>0</manaCost>
  25.         <energyCost>0</energyCost>
  26.         <lifeCost>0</lifeCost>
  27.  
  28.         <abilityActions> <!-- actual actions this ability performs -->
  29.             <event type="OnAbilityActivated"> <!-- actions when ability is activated -->
  30.                 <actions>
  31.                     <action>
  32.                         <class>Damage</class> <!-- type of action -->
  33.                         <damageType>PHYSICAL</damageType> <!-- type of damage -->
  34.                         <target>TARGET</target> <!-- The target to do damage on -->
  35.                         <damage>Weapon</damage> <!-- Amount of damage -->
  36.                     </action>
  37.                 </actions>
  38.             </event>
  39.         </abilityActions>
  40.     </ability>
  41.  
  42. <!-- A bit more special one, with better documentation. It creates a magical attack that heals nearby allies on success.-->
  43. <ability name="DefineSubtraction">
  44.             <range>use_range</range> <!-- corrsponds to parameter -->
  45.             <AI><!-- for AI to decide what to do -->
  46.                 <abilityType>
  47.                     <type>MELEE</type>
  48.                     <type>SINGLE_TARGET</type>
  49.                     <type>DAMAGE</type>
  50.                     <type>HEAL_FRIENDLY</type>
  51.                 </abilityType>
  52.             </AI>
  53.  
  54.             <!-- The behavior of the skill -->
  55.             <behaviors>
  56.                 <behavior>CREATURE_TARGET</behavior> <!-- Creature need to select a target on activation -->
  57.                 <behavior>MAGIC</behavior> <!-- Cannot target magic imune and does not trigger PhysicalDamageTaken -->
  58.                 <!-- More things like NO_TARGET, COORDINATE_TARGET, PASSIVE, SUSTAINED can be added and they act like bits in a bitset -->
  59.             </behaviors>
  60.  
  61.             <requirements><!-- Requirements to use this ability also creates a bitset from the combinations -->
  62.                 <requirement>SPELL_BOOK</requirement> <!-- Need a spell book -->
  63.                 <!-- Could have many requirements like AXE + TWO_HANDED would require 2 handed axe and MELEE_WEAPON + SINGLE_HANDED requires single handed melee weapon -->
  64.             </requirements>
  65.  
  66.             <!-- The parameters, this actually is the thing I'm worried about. As you can see I need this here, especially when modders want to introduce new creatures with different stats and all.
  67.             It will also hold additional information to show information about the ability. I also need this to add additional data at runtime, like when I need current data of the owner. -->
  68.             <parameters>
  69.                 <parameter type="int">
  70.                     <name>use_range</name>
  71.                     <value>10</value>
  72.                 </parameter>
  73.                 <parameter type="int">
  74.                     <name>spell_damage</name>
  75.                     <value>20</value>
  76.                 </parameter>
  77.                 <parameter type="int">
  78.                     <name>heal_radius</name>
  79.                     <value>200</value>
  80.                 </parameter>
  81.             </parameters>
  82.  
  83.             <!-- Basic stats, not really sure what I exactly need. I probably put all this in parameters eventually -->
  84.             <tickCost>WeaponSpeed</tickCost>
  85.             <cooldown>0</cooldown>
  86.             <manaCost>0</manaCost>
  87.             <energyCost>0</energyCost>
  88.             <lifeCost>0</lifeCost>
  89.  
  90.             <!-- The actual action blocks for the ability start here.
  91.             For each phase you can add abilities, there are many phases like:
  92.             OnDamageTaken, OnAbilitySuccess, OnDeath, OnEquip, etc, etc. -->
  93.             <abilityActions>
  94.                 <event type="OnAbilityActivated"><!-- Actions that trigger when ability is activated -->
  95.                     <actions>
  96.                         <!-- The actions in order of execution. Actions can force everything to stop until finished or just run in one go by default. Actions are essentially classes that get instantiated for this ability. So these are hardcoded and run by the ability, the actions handle everything what happens in the game world. I could even hook actions up to map objects so a explosive barel could have a OnHit modifier that releases a AOE explosion. Some actions are: DamageAction, Projectile, PlaySound, Move, Effect, AOE and many more. But just with those 4 I can make most abilities of any game. I keep them very basic DamageAction just does damage and might trigger onDamageTaken. AOE just fills a list with participants for the next action in line to use.-->
  97.                         <action>
  98.                             <!-- regular damage action -->
  99.                             <class>Damage</class>
  100.                             <!-- DamageAction type -->
  101.                             <damageType>MAGICAL</damageType>
  102.                             <!-- The target, since the behavior is CREATURE_TARGET I know it has been filled when ability is activated -->
  103.                             <target>TARGET</target>
  104.                             <!-- amount of damage from parameters -->
  105.                             <damage>Spell_Damage</damage>
  106.                         </action>
  107.                     </actions>
  108.                 </event>
  109.  
  110.                 <event type="OnAbilitySuccess"><!-- Actions that trigger when a initial ability was successfully, for example landing a attack although OnAttackLanded is another Phase that can be triggered  -->
  111.                     <actions>
  112.                         <!-- here I queue two actions up, I can essentially create hundreds of actions here that all behave differently. -->
  113.                         <action>
  114.                             <!-- puts all creatures found in the parameters -->
  115.                             <class>AOE</class>
  116.                             <!-- bitset to determine what creatures to add -->
  117.                             <target_type>
  118.                                 <type>FRIENDLY</type>
  119.                                 <type>NEUTRAL</type>
  120.                                 <type>ALLIED</type>
  121.                             </target_type>
  122.                             <!-- point from where to draw circle of influence -->
  123.                             <origin>OWNER_ORIGIN</origin>
  124.                             <!-- radius of circle of influence -->
  125.                             <radius>heal_radius</radius>
  126.                         </action>
  127.  
  128.                         <action>
  129.                             <!-- action that heals -->
  130.                             <class>Heal</class>
  131.                             <!-- Target, since AOE object always stores crteature in map as "TARGETS", creatureSet I can just put TARGETS here-->
  132.                             <target>TARGETS</target>
  133.                             <!-- Amount to be healed, from parameters -->
  134.                             <damage>HealAmount</damage>
  135.                         </action>
  136.                     </actions>
  137.                 </event>
  138.             </abilityActions>
  139.         </ability>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement