diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-06-10 15:11:01 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-01-08 16:58:57 +0100 |
commit | 6f287f239e9d94707735b183d6c6b89eea9fef20 (patch) | |
tree | 694427dbff77f73a1a3a4f84b4f53269a4763f74 /example | |
parent | 0f0004ff3e286270c0425642a5669661ef6cb592 (diff) | |
download | manaserv-6f287f239e9d94707735b183d6c6b89eea9fef20.tar.gz manaserv-6f287f239e9d94707735b183d6c6b89eea9fef20.tar.bz2 manaserv-6f287f239e9d94707735b183d6c6b89eea9fef20.tar.xz manaserv-6f287f239e9d94707735b183d6c6b89eea9fef20.zip |
Work on (Auto)Attack system.
During the implementation bjorn and I agreed to limit the number of attacks that
can be used in the same tick to one. This makes a lot of stuff easier and the
client cannot display two frames at the same time
Things done:
- Implemented setting of attacks when equipping/unequipping items
- Single place where the xml attack node is parsed
- Finished attack logic
- Unified the attack handling of monsters and characters
- Added a global cooldown after attack use
(not only for next use of same attack)
- Removed the temponary attributes for the monster attack values
- Priorities for all attacks
- Rewrote the attack core:
- Attacks now have this attributes:
- warmup -> time a attack needs after starting it to actually deal the damage
- cooldown -> time a attack needs after dealing damage before another attack
can be used
- reuse -> time before the same attack can be used again
- If no attack is performed at the moment the following is done:
- make a list with all ready attacks
- check for attack that has the necessarily range and highest priority
- start this attack (inform client about it)
- when warmup is finished -> trigger damage
- when cooldown is finished -> allow to use other (or the same if reusetimer
allows) attacks
TODO:
- sync client with this to allow better timed animations
Diffstat (limited to 'example')
-rw-r--r-- | example/attributes.xml | 17 | ||||
-rw-r--r-- | example/items.xml | 17 | ||||
-rw-r--r-- | example/monsters.xml | 98 |
3 files changed, 71 insertions, 61 deletions
diff --git a/example/attributes.xml b/example/attributes.xml index 69346e58..e0e8829c 100644 --- a/example/attributes.xml +++ b/example/attributes.xml @@ -173,21 +173,4 @@ <modifier stacktype="stackable" modtype="additive" tag="cap1" effect="Capacity %+.2f" /> </attribute> <!-- End of core-attributes definition --> - - <!-- Temporary definitions for monsters until the auto-attack system is finished. --> - <attribute id="20" name="physical attack (minimum)" - modifiable="false" - scope="monster" - minimum="0" - maximum="255" /> - <attribute id="21" name="physical attack (delta)" - modifiable="false" - scope="monster" - minimum="0" - maximum="255" /> - <attribute id="22" name="magical attack" - modifiable="false" - scope="monster" - minimum="0" - maximum="255" /> </attributes> diff --git a/example/items.xml b/example/items.xml index e58949e4..3ed6ec9d 100644 --- a/example/items.xml +++ b/example/items.xml @@ -117,9 +117,12 @@ </equip> <effect trigger="equip"> <modifier attribute="acc1" value="1.0" /> - <attack skill="102" warmupspeed="10" cooldownspeed="166" - basedamage="50" deltadamage="10" chancetohit="2" range="32" - element="neutral" damagetype="physical" /> + <attack skill="102" warmuptime="1" cooldowntime="5" reusetime="1" + basedamage="1" deltadamage="10" chancetohit="200" range="320" + element="neutral" type="physical" /> + <attack skill="102" priority="2" warmuptime="100" cooldowntime="10" reusetime="100" + basedamage="50" deltadamage="10" chancetohit="200" range="320" + element="neutral" type="physical" /> </effect> <effect trigger="in-inventory"> <modifier attribute="cap1" value="-2000" /> @@ -134,9 +137,9 @@ <slot type="hand" required="2" /> </equip> <effect trigger="equip"> - <attack skill="106" warmupspeed="10" cooldownspeed="166" + <attack skill="106" warmuptime="10" cooldowntime="166" basedamage="50" deltadamage="10" chancetohit="2" range="160" - element="neutral" damagetype="physical" /> + element="neutral" type="physical" /> <modifier attribute="acc1" value="1.5" /> </effect> <effect trigger="in-inventory"> @@ -152,9 +155,9 @@ <slot type="hand" required="1" /> </equip> <effect trigger="equip"> - <attack skill="100" warmupspeed="10" cooldownspeed="166" + <attack skill="100" warmuptime="10" cooldowntime="10" reusetime="20" basedamage="50" deltadamage="10" chancetohit="2" range="32" - element="neutral" damagetype="physical" /> + element="neutral" type="physical" /> <modifier attribute="acc1" value="1.5" /> </effect> <effect trigger="in-inventory"> diff --git a/example/monsters.xml b/example/monsters.xml index 962b137e..5e73e93e 100644 --- a/example/monsters.xml +++ b/example/monsters.xml @@ -21,10 +21,6 @@ attributes <TAG>: Tells all the monsters attribute. These attribute, as for ite size[integer]: The monster maximal amplitude in pixels. Used to compute player's hit area. speed[float]: The monster's speed in tiles per second. (A tile is the smallest square map unit: by default, a tile is 32 pixel long.) - attack-min[integer]: The minimal attack strength of the monster. If your hasn't got any armor, - there are the minimal hit points he will lose when hit by the monster. - attack-delta[integer]: The amplitude between minimal and maximal damages the monster can do. - attack-magic[integer]: The magical attacks are removing hp when hit but are computed against magical defense instead. mutation[integer]: The mutation indicates the amplitude in percent where attributes get modified with. For instance, with a mutation of 50, each attribute can be altered to become 100% to 149% of what they are. vulnerability<TAG>: Tells the monster specific vulnerability to an element. @@ -46,12 +42,9 @@ exp<TAG>: Tells how much experience point a monster is giving up <drop item="3" percent="2.8"/> <drop item="4" percent="0.7"/> <attributes - hp="20" + hp="200" size="4" speed="2.0" - attack-min="10" - attack-delta="2" - attack-magic="0" hit="10" evade="5" magical-evade="5" @@ -73,12 +66,28 @@ exp<TAG>: Tells how much experience point a monster is giving up <attack id="1" priority="1" type="physical" - pre-delay="10" - aft-delay="5" - damage-factor="1" + warmuptime="10" + cooldowntime="10" + reusetime="10" + basedamage="10" + deltadamage="1" + chancetohit="1000" + element="neutral" + range="32" + animation="attack" + /> + <attack id="2" + priority="2" + type="physical" + warmuptime="0" + cooldowntime="100" + reusetime="100" + basedamage="100" + deltadamage="1" + chancetohit="1000" + element="neutral" range="32" animation="attack" - script-event="strike" /> <script>testmonster.lua</script> <!-- only Proof of Concept--> </monster> @@ -99,9 +108,6 @@ exp<TAG>: Tells how much experience point a monster is giving up hp="20" size="8" speed="6.0" - attack-min="10" - attack-delta="2" - attack-magic="0" hit="10" evade="10" magical-evade="10" @@ -120,21 +126,29 @@ exp<TAG>: Tells how much experience point a monster is giving up <attack id="1" priority="1" type="physical" - pre-delay="5" - aft-delay="15" - damage-factor="3" - range="64" - particle-effect="graphics/particles/attack.particle.xml" - action="special1" + warmuptime="10" + cooldowntime="100" + reusetime="100" + basedamage="20" + deltadamage="1" + chancetohit="1000" + element="neutral" + range="32" + animation="attack" /> <!-- fast, weak, short-range scissor attack --> <attack id="2" - priority="4" + priority="2" type="physical" - pre-delay="3" - aft-delay="3" - damage-factor="1" + warmuptime="0" + cooldowntime="5" + reusetime="1" + basedamage="5" + deltadamage="1" + chancetohit="1000" + element="neutral" range="32" + animation="attack" /> </monster> @@ -155,9 +169,6 @@ exp<TAG>: Tells how much experience point a monster is giving up hp="20" size="8" speed="6.0" - attack-min="20" - attack-delta="10" - attack-magic="0" hit="30" evade="30" magical-evade="30" @@ -177,11 +188,15 @@ exp<TAG>: Tells how much experience point a monster is giving up <attack id="1" priority="1" type="physical" - element="fire" - pre-delay="5" - aft-delay="10" - damage-factor="1" - range="64" + warmuptime="0" + cooldowntime="100" + reusetime="100" + basedamage="100" + deltadamage="1" + chancetohit="1000" + element="neutral" + range="32" + animation="attack" /> </monster> @@ -200,15 +215,25 @@ exp<TAG>: Tells how much experience point a monster is giving up hp="200" size="4" speed="1.0" - attack-min="2" - attack-delta="10" - attack-magic="0" hit="100" evade="10" magical-evade="10" physical-defence="0" magical-defence="0" /> + <attack id="1" + priority="1" + type="physical" + warmuptime="0" + cooldowntime="100" + reusetime="100" + basedamage="100" + deltadamage="1" + chancetohit="1000" + element="neutral" + range="32" + animation="attack" + /> <!-- Is fulfilling some unknown purpose that requires it to move around a lot and leaves no time for pursing attackers --> <behavior @@ -216,7 +241,6 @@ exp<TAG>: Tells how much experience point a monster is giving up cowardly="false" track-range="4" stroll-range="24" - attack-distance="32" /> </monster> |