Skip to content

Commit

Permalink
Merge pull request #8 from Glasislundr/abilitybuilder
Browse files Browse the repository at this point in the history
Ability Builder v0.5
  • Loading branch information
Glasislundr authored Nov 5, 2023
2 parents f470b0b + 49e4b2b commit 7cf46b9
Show file tree
Hide file tree
Showing 56 changed files with 1,416 additions and 380 deletions.
128 changes: 114 additions & 14 deletions core/assets/abilityBehaviors/Transformations.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "if",
"condition": {
"type": "isToggleAbilityActive"
Expand Down Expand Up @@ -278,6 +278,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand All @@ -301,7 +315,7 @@
}],
"elseActions": []
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -657,7 +671,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "if",
"condition": {
"type": "isToggleAbilityActive"
Expand Down Expand Up @@ -716,6 +730,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand Down Expand Up @@ -745,7 +773,7 @@
}],
"elseActions": []
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -1110,7 +1138,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "createNonStackingStatBuff",
"buffType": {
"type": "getNonStackingStatBuffTypeFromString",
Expand Down Expand Up @@ -1185,6 +1213,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand Down Expand Up @@ -1226,7 +1268,7 @@
}],
"elseActions": []
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -1621,7 +1663,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "createStateModBuff",
"buffType": "ETHEREAL"
},{
Expand Down Expand Up @@ -1683,6 +1725,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand Down Expand Up @@ -1732,7 +1788,7 @@
}
}]
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -2108,7 +2164,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "createStateModBuff",
"buffType": "ETHEREAL"
},{
Expand Down Expand Up @@ -2170,6 +2226,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand Down Expand Up @@ -2211,7 +2281,7 @@
}],
"elseActions": []
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -2596,7 +2666,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "if",
"condition": {
"type": "isToggleAbilityActive"
Expand Down Expand Up @@ -2655,6 +2725,20 @@
}
}
},
"requiresPayment": {
"type": "i2b",
"value": {
"type": "i&",
"value1": {
"type": "getAbilityDataAsInteger",
"dataField": "B"
},
"value2": {
"type": "rawInteger",
"value": 16
}
}
},
"altitudeAdjustmentDelay": {
"type": "getAbilityCastTime"
},
Expand All @@ -2678,7 +2762,7 @@
}],
"elseActions": []
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -3038,7 +3122,7 @@
}
}
},
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "createNonStackingStatBuff",
"buffType": {
"type": "getNonStackingStatBuffTypeFromString",
Expand All @@ -3055,7 +3139,7 @@
"dataField": "E"
}
}],
"onRemoveAbility": [{
"onRemoveDisabledAbility": [{
"type": "transformedUnitAbilityRemove",
"unit": {
"type": "getCastingUnit"
Expand Down Expand Up @@ -3221,5 +3305,21 @@
}
}]
}]
},{
"ids": [{"id":"Acha"}],
"type": "HIDDEN",
"onAddAbility": [{
"type": "transformUnitInstant",
"unit": {
"type": "getCastingUnit"
},
"alternateUnitId": {
"type": "getAbilityUnitId"
},
"permanent": {
"type": "rawBoolean",
"value": "true"
}
}]
}]
}
2 changes: 1 addition & 1 deletion core/assets/abilityBehaviors/humanUnitActives.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
}
}
}],
"onAddAbility": [{
"onAddDisabledAbility": [{
"type": "if",
"condition": {
"type": "isToggleAbilityActive"
Expand Down
2 changes: 1 addition & 1 deletion core/src/com/etheller/warsmash/parsers/jass/Jass2.java
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ public JassValue call(final List<JassValue> arguments, final GlobalScope globalS
final double facing = arguments.get(3).visit(RealJassValueVisitor.getInstance());
final War3ID blightedMineRawcode = War3ID.fromString("ugol");
final War3ID goldMineRawcode = War3ID.fromString("ngol");
player.addTechtreeUnlocked(blightedMineRawcode);
player.addTechtreeUnlocked(simulation, blightedMineRawcode);
final CUnit blightedMine = CommonEnvironment.this.simulation.createUnitSimple(
blightedMineRawcode, player.getId(), (float) x, (float) y, (float) facing);
final CUnit goldMine = CommonEnvironment.this.simulation.createUnitSimple(goldMineRawcode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static int matchRank(final EnumSet<AnimationTokens.SecondaryTag> goalTagS
return matchRank;
}

public static IndexedSequence selectSequence(final AnimationTokens.PrimaryTag type,
public static IndexedSequence selectSequence(AnimationTokens.PrimaryTag type,
final EnumSet<AnimationTokens.SecondaryTag> tags, final List<Sequence> sequences,
final boolean allowRarityVariations) {
List<IndexedSequence> filtered = filterSequences(type, tags, sequences);
Expand All @@ -141,6 +141,9 @@ public static IndexedSequence selectSequence(final AnimationTokens.PrimaryTag ty
}
}
if (fallbackTags == null) {
if (type == null) {
type = PrimaryTag.STAND;
}
for (int i = 0, l = sequences.size(); i < l; i++) {
final Sequence sequence = sequences.get(i);
if (sequence.getPrimaryTags().contains(type) || (type == null)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public void missingRequirement(final War3ID type, final int level) {
final CUnitType unitType = unitData.getUnitType(type);
String requirementString;
if (unitType != null) {
requirementString = unitType.getName();
if (level > 1) {
requirementString = level + " " + unitType.getName() + "s";
} else {
requirementString = unitType.getName();
}
} else {
final CUpgradeType upgradeType = upgradeData
.getType(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ private void addCommandButton(final CAbility ability, final IconUI iconUI, final
private void addCommandButton(final CAbility ability, final Texture icon, final Texture iconDisabled,
final String toolTip, String uberTip, final int buttonPosX, final int buttonPosY, final int handleId,
final int orderId, final int autoCastOrderId, final boolean autoCastActive, final boolean menuButton,
int goldCost, int lumberCost, int foodCost, final int manaCost, final int numberOverlay,
int goldCost, int lumberCost, int foodCost, int manaCost, final int numberOverlay,
final char hotkey) {
boolean requiresPatron = false;
if (this.unit.getPlayerIndex() != this.localPlayerIndex) {
Expand Down Expand Up @@ -496,6 +496,7 @@ private void addCommandButton(final CAbility ability, final Texture icon, final
goldCost = 0;
lumberCost = 0;
foodCost = 0;
manaCost = 0;
}
if (this.previewCallback.isShowingRequirements()) {
uberTip = this.previewCallback.getRequirementsText() + "|r" + uberTip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public CUnit createUnitSimple(final War3ID typeId, final int playerIndex, final
if (newUnitType.getFoodMade() != 0) {
player.setFoodCap(player.getFoodCap() + newUnitType.getFoodMade());
}
player.addTechtreeUnlocked(typeId);
player.addTechtreeUnlocked(this, typeId);
// nudge unit
newUnit.setPointAndCheckUnstuck(x, y, this);
if (!newUnit.isBuilding()) {
Expand Down Expand Up @@ -677,7 +677,7 @@ public void unitsLoaded() {
final CPlayer player = this.players.get(unit.getPlayerIndex());
player.setUnitFoodUsed(unit, unit.getUnitType().getFoodUsed());
player.setUnitFoodMade(unit, unit.getUnitType().getFoodMade());
player.addTechtreeUnlocked(unit.getTypeId());
player.addTechtreeUnlocked(this, unit.getTypeId());
}
}

Expand Down
Loading

0 comments on commit 7cf46b9

Please sign in to comment.