Skip to content

Commit

Permalink
fix mutation activation EoC once again (#71445)
Browse files Browse the repository at this point in the history
* fix mutation activation EoC once again

* Apply suggestions from code review
  • Loading branch information
GuardianDll authored Feb 3, 2024
1 parent eefe420 commit 307f750
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "effect_on_condition",
"id": "EOC_GENERIC_SPELL_MUTATION",
"//energy_amount": "optional, how much stamina you spend on activation of the mutation - EoC works exclusively with stamina, to consume calories, fatigue or thirst use corresponding booleans in mutation; default zero if you don't need to consume stamina",
"//prep_time": "time you spend to prepare the activation, in seconds. Use 0 to make activation instant",
"//prep_time": "time you spend to prepare the activation, in seconds. Use 0 to make activation instant. Decimals are allowed, 0.5 means 50 moves",
"//spell_to_cast": "spell that would be casted if activation is successful",
"//message_success": "message that would be printed if activation is successful",
"//message_fail": "message, that would be printed, if you have less stamina than required",
Expand All @@ -14,21 +14,15 @@
]
},
"effect": [
{ "u_assign_activity": "ACT_GENERIC_EOC", "duration": { "context_val": "prep_time" } },
{ "turn_cost": { "context_val": "prep_time" } },
{ "math": [ "u_val('stamina')", "-=", "_energy_amount" ] },
{
"if": { "math": [ "_prep_time", ">", "1" ] },
"then": { "queue_eocs": [ "EOC_GENERIC_SPELL_MUTATION_ACT" ], "time_in_future": { "math": [ "_prep_time - 1" ] } },
"else": { "run_eocs": [ "EOC_GENERIC_SPELL_MUTATION_ACT" ] }
}
{ "run_eocs": [ "EOC_GENERIC_SPELL_MUTATION_ACT" ] }
],
"false_effect": [ { "u_message": { "context_val": "message_fail" }, "type": "bad" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_GENERIC_SPELL_MUTATION_ACT",
"//": "no proper way to check activity type to ensure player still prepare the mutation, so only level is checked for now (if spell is not instant)",
"condition": { "or": [ { "math": [ "u_val('activity_level')", "==", "0" ] }, { "math": [ "_prep_time", "==", "0" ] } ] },
"effect": [
{
"u_cast_spell": { "id": { "context_val": "spell_to_cast" }, "message": { "context_val": "message_success" } },
Expand Down
10 changes: 9 additions & 1 deletion doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3695,7 +3695,7 @@ Subtract this many turns from the alpha talker's moves.

| Syntax | Optionality | Value | Info |
| --- | --- | --- | --- |
| "turn_cost" | **mandatory** | number, duration, [variable object](##variable-object) or value between two | how long the action takes (can be specified in number of turns, or as a duration) |
| "turn_cost" | **mandatory** | number, duration, [variable object](##variable-object) or value between two | how long the action takes (can be specified in number of turns (as decimal), or as a duration) |

##### Examples

Expand All @@ -3707,6 +3707,14 @@ Subtract this many turns from the alpha talker's moves.
}
```

```json
{
"effect": [
{ "turn_cost": 0.6 }
]
}
```

##### Valid talkers:

| Avatar | Character | NPC | Monster | Furniture | Item |
Expand Down

0 comments on commit 307f750

Please sign in to comment.