Skip to content

Commit 069353e

Browse files
committed
Quick Implementation of Sound Hooks
* AB: Added sound hooks to allow creation of sound effects * AB: Added a cast sound to Mana Shield * AB: Fixed a Flamestrike bug introduced by an earlier change
1 parent 5a22d8c commit 069353e

6 files changed

Lines changed: 97 additions & 7 deletions

File tree

core/assets/abilityBehaviors/humanHeroActives.json

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"ids": [{"id":"AHfs", "castId": "flamestrike"}],
44
"type": "NORMAL_POINTTARGET",
55
"onBeginCasting": [{
6+
"type": "storeValueLocally",
7+
"key": {
8+
"type": "rawString",
9+
"value": "targetLoc"
10+
},
11+
"valueToStore": {
12+
"type": "getTargetedLocation"
13+
}
14+
},{
615
"type": "createTemporarySpellEffectAtLocation",
716
"location": {
817
"type": "getTargetedLocation"
@@ -113,7 +122,11 @@
113122
"value1": {
114123
"type": "getLocationX",
115124
"location": {
116-
"type": "getTargetedLocation"
125+
"type": "getStoredLocationByKey",
126+
"key": {
127+
"type": "rawString",
128+
"value": "targetLoc"
129+
}
117130
}
118131
},
119132
"value2": {
@@ -142,7 +155,11 @@
142155
"value1": {
143156
"type": "getLocationY",
144157
"location": {
145-
"type": "getTargetedLocation"
158+
"type": "getStoredLocationByKey",
159+
"key": {
160+
"type": "rawString",
161+
"value": "targetLoc"
162+
}
146163
}
147164
},
148165
"value2": {
@@ -218,7 +235,11 @@
218235
"value": {
219236
"type": "countUnitsInRangeOfLocation",
220237
"location": {
221-
"type": "getTargetedLocation"
238+
"type": "getStoredLocationByKey",
239+
"key": {
240+
"type": "rawString",
241+
"value": "targetLoc"
242+
}
222243
},
223244
"range": {
224245
"type": "getAbilityArea"
@@ -250,7 +271,11 @@
250271
},{
251272
"type": "iterateUnitsInRangeOfLocation",
252273
"location": {
253-
"type": "getTargetedLocation"
274+
"type": "getStoredLocationByKey",
275+
"key": {
276+
"type": "rawString",
277+
"value": "targetLoc"
278+
}
254279
},
255280
"range": {
256281
"type": "getAbilityArea"
@@ -399,7 +424,11 @@
399424
"value": {
400425
"type": "countUnitsInRangeOfLocation",
401426
"location": {
402-
"type": "getTargetedLocation"
427+
"type": "getStoredLocationByKey",
428+
"key": {
429+
"type": "rawString",
430+
"value": "targetLoc"
431+
}
403432
},
404433
"range": {
405434
"type": "getAbilityArea"
@@ -431,7 +460,11 @@
431460
},{
432461
"type": "iterateUnitsInRangeOfLocation",
433462
"location": {
434-
"type": "getTargetedLocation"
463+
"type": "getStoredLocationByKey",
464+
"key": {
465+
"type": "rawString",
466+
"value": "targetLoc"
467+
}
435468
},
436469
"range": {
437470
"type": "getAbilityArea"

core/assets/abilityBehaviors/neutralHeroUnitActives.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@
104104
}]
105105
}],
106106
"onBeginCasting": [{
107+
"type": "createSoundEffectOnUnit",
108+
"unit": {
109+
"type": "getCastingUnit"
110+
},
111+
"id": {
112+
"type": "getAlias"
113+
}
114+
},{
107115
"type": "createPassiveBuff",
108116
"buffId": {
109117
"type": "getFirstBuffId"

core/src/com/etheller/warsmash/viewer5/handlers/w3x/simulation/abilitybuilder/behavior/CBehaviorAbilityBuilderBase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public CBehavior update(final CSimulation game, boolean withinFacingWindow) {
118118
}
119119
}
120120
if ((ticksSinceCast >= backswingTicks) && !this.channeling) {
121-
System.out.println("Removing targets");
122121
this.localStore.remove(ABLocalStoreKeys.ABILITYTARGETEDUNIT + castId);
123122
this.localStore.remove(ABLocalStoreKeys.ABILITYTARGETEDDESTRUCTABLE + castId);
124123
this.localStore.remove(ABLocalStoreKeys.ABILITYTARGETEDITEM + castId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.action;
2+
3+
import java.util.Map;
4+
5+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CSimulation;
6+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CUnit;
7+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.callback.idcallbacks.ABIDCallback;
8+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.callback.unitcallbacks.ABUnitCallback;
9+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.core.ABAction;
10+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.core.ABLocalStoreKeys;
11+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.SimulationRenderComponent;
12+
13+
public class ABActionCreateLoopingSoundEffectOnUnit implements ABAction {
14+
15+
private ABUnitCallback unit;
16+
private ABIDCallback id;
17+
18+
public void runAction(final CSimulation game, final CUnit caster, final Map<String, Object> localStore,
19+
final int castId) {
20+
SimulationRenderComponent ret = game.unitLoopSoundEffectEvent(
21+
(unit.callback(game, caster, localStore, castId)), this.id.callback(game, caster, localStore, castId));
22+
localStore.put(ABLocalStoreKeys.LASTCREATEDFX, ret);
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.action;
2+
3+
import java.util.Map;
4+
5+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CSimulation;
6+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CUnit;
7+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.callback.idcallbacks.ABIDCallback;
8+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.behavior.callback.unitcallbacks.ABUnitCallback;
9+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.core.ABAction;
10+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilitybuilder.core.ABLocalStoreKeys;
11+
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.SimulationRenderComponent;
12+
13+
public class ABActionCreateSoundEffectOnUnit implements ABAction {
14+
15+
private ABUnitCallback unit;
16+
private ABIDCallback id;
17+
18+
public void runAction(final CSimulation game, final CUnit caster, final Map<String, Object> localStore,
19+
final int castId) {
20+
SimulationRenderComponent ret = game.unitSoundEffectEvent(
21+
(unit.callback(game, caster, localStore, castId)), this.id.callback(game, caster, localStore, castId));
22+
localStore.put(ABLocalStoreKeys.LASTCREATEDFX, ret);
23+
}
24+
}

core/src/com/etheller/warsmash/viewer5/handlers/w3x/simulation/abilitybuilder/core/AbilityBuilderGsonBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ private static void registerActions(RuntimeTypeAdapterFactory<ABAction> factory)
375375
"createTemporarySpellEffectAtLocation")
376376
.registerSubtype(ABActionCreateSpellEffectAtPoint.class, "createSpellEffectAtPoint")
377377
.registerSubtype(ABActionCreateTemporarySpellEffectAtPoint.class, "createTemporarySpellEffectAtPoint")
378+
.registerSubtype(ABActionCreateSoundEffectOnUnit.class, "createSoundEffectOnUnit")
379+
.registerSubtype(ABActionCreateLoopingSoundEffectOnUnit.class, "createLoopingSoundEffectOnUnit")
378380
.registerSubtype(ABActionCreateLightningEffect.class, "createLightningEffect")
379381
.registerSubtype(ABActionRemoveLightningEffect.class, "removeLightningEffect")
380382

0 commit comments

Comments
 (0)