Add logic for using items on the Spotted Mudpuppy in 'Factual Folklore'

This commit is contained in:
Liza 2025-01-19 22:58:14 +01:00
parent e0f416a5cd
commit 4b9eae916a
Signed by: liza
GPG Key ID: 2C41B84815CF6445
5 changed files with 18 additions and 6 deletions

View File

@ -35,10 +35,13 @@
"Z": 89.58569 "Z": 89.58569
}, },
"TerritoryId": 155, "TerritoryId": 155,
"InteractionType": "Instruction", "InteractionType": "Combat",
"Comment": "Use Quest item on enemy to weaken it first",
"$": "Status Effects: 22 (HP Penalty) + 62 (Damage Down)",
"EnemySpawnType": "AfterInteraction", "EnemySpawnType": "AfterInteraction",
"CombatItemUse": {
"ItemId": 2000961,
"Condition": "MissingStatus",
"Value": 22
},
"ComplexCombatData": [ "ComplexCombatData": [
{ {
"DataId": 2196 "DataId": 2196

View File

@ -183,7 +183,8 @@
"null" "null"
], ],
"description": "The Item to use", "description": "The Item to use",
"exclusiveMinimum": 0 "exclusiveMinimum": 0,
"maximum": 2010000
}, },
"SkipConditions": { "SkipConditions": {
"type": "object", "type": "object",
@ -648,13 +649,15 @@
"type": "object", "type": "object",
"properties": { "properties": {
"ItemId": { "ItemId": {
"type": "integer" "type": "integer",
"maximum": 2010000
}, },
"Condition": { "Condition": {
"type": "string", "type": "string",
"enum": [ "enum": [
"Incapacitated", "Incapacitated",
"Health%" "Health%",
"MissingStatus"
] ]
}, },
"Value": { "Value": {

View File

@ -9,5 +9,6 @@ public sealed class CombatItemUseConditionConverter() : EnumConverter<ECombatIte
{ {
{ ECombatItemUseCondition.Incapacitated, "Incapacitated" }, { ECombatItemUseCondition.Incapacitated, "Incapacitated" },
{ ECombatItemUseCondition.HealthPercent, "Health%" }, { ECombatItemUseCondition.HealthPercent, "Health%" },
{ ECombatItemUseCondition.MissingStatus, "MissingStatus" },
}; };
} }

View File

@ -5,4 +5,5 @@ public enum ECombatItemUseCondition
None, None,
Incapacitated, Incapacitated,
HealthPercent, HealthPercent,
MissingStatus,
} }

View File

@ -108,6 +108,7 @@ internal sealed class ItemUseModule : ICombatModule
_delegate.Stop(); _delegate.Stop();
unsafe unsafe
{ {
_logger.LogInformation("Using item {ItemId}", _combatData.CombatItemUse.ItemId);
AgentInventoryContext.Instance()->UseItem(_combatData.CombatItemUse.ItemId); AgentInventoryContext.Instance()->UseItem(_combatData.CombatItemUse.ItemId);
} }
_continueAt = DateTime.Now.AddSeconds(2); _continueAt = DateTime.Now.AddSeconds(2);
@ -147,6 +148,9 @@ internal sealed class ItemUseModule : ICombatModule
if (_combatData.CombatItemUse.Condition == ECombatItemUseCondition.HealthPercent) if (_combatData.CombatItemUse.Condition == ECombatItemUseCondition.HealthPercent)
return (100f * battleChara->Health / battleChara->MaxHealth) < _combatData.CombatItemUse.Value; return (100f * battleChara->Health / battleChara->MaxHealth) < _combatData.CombatItemUse.Value;
if (_combatData.CombatItemUse.Condition == ECombatItemUseCondition.MissingStatus)
return !battleChara->StatusManager.HasStatus((uint)_combatData.CombatItemUse.Value);
} }
return false; return false;