public virtual IEnumerator AddSpellCostModifier(SpellCostModification spellCostModifier) { int id = spellCostModifier.id; if (m_spellCostModifiers.ContainsKey(id)) { Log.Error($"Tried to add spell cost modifier with id {id} multiple times.", 315, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\UI\\FightRework\\PlayerUI\\AbstractPlayerUIRework.cs"); } else { m_spellCostModifiers.Add(spellCostModifier.id, spellCostModifier); } yield break; }
public override void UpdateModifications(ref GaugesModification modifications, PlayerStatus player, DynamicValueContext context) { this.value.GetValue(context, out int value); CastTargetContext castTargetContext = context as CastTargetContext; if (castTargetContext != null) { if (!RuntimeData.spellDefinitions.TryGetValue(castTargetContext.spellDefinitionId, out SpellDefinition value2)) { Log.Error($"Could not find spell definition with id {castTargetContext.spellDefinitionId}.", 69, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\Costs\\ActionPointsCost.cs"); return; } value = SpellCostModification.ApplyCostModification(player.spellCostModifiers, value, value2, castTargetContext); } modifications.Increment(CaracId.ActionPoints, -value); }
public override void UpdateStatus(FightStatus fightStatus) { if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus)) { SpellCostModification spellCostModifier = new SpellCostModification(modifierId, modificationValue, spellFiltersJson); entityStatus.AddSpellCostModifier(spellCostModifier); AbstractPlayerUIRework view = entityStatus.view; if (null != view) { view.RefreshAvailableActions(recomputeSpellCosts: true); } } else { Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 27, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellCostModifierAddedEvent.cs"); } FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.SpellCostModification); }
public static void RecomputeSpellCost(SpellStatus spellStatus, ref SpellStatusData data) { if (spellStatus.ownerPlayer != null) { int?baseCost = spellStatus.baseCost; if (!baseCost.HasValue) { data.apCost = null; data.baseCost = null; return; } SpellDefinition definition = spellStatus.definition; CastTargetContext context = spellStatus.CreateCastTargetContext(); int cost = spellStatus.definition.GetCost(context) ?? 0; data.apCost = SpellCostModification.ApplyCostModification(spellStatus.ownerPlayer.spellCostModifiers, cost, definition, context); data.baseCost = baseCost.Value; } }
private static CastValidity CheckForSpell(PlayerStatus playerStatus, DynamicValueContext context, int baseCost) { CastTargetContext castTargetContext = context as CastTargetContext; if (castTargetContext == null) { return(CastValidity.DATA_ERROR); } if (!RuntimeData.spellDefinitions.TryGetValue(castTargetContext.spellDefinitionId, out SpellDefinition value)) { Log.Error($"Could not find spell definition with id {castTargetContext.spellDefinitionId}.", 44, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\Costs\\ActionPointsCost.cs"); return(CastValidity.DATA_ERROR); } int num = SpellCostModification.ApplyCostModification(playerStatus.spellCostModifiers, baseCost, value, castTargetContext); if (playerStatus.actionPoints < num) { return(CastValidity.NOT_ENOUGH_ACTION_POINTS); } return(CastValidity.SUCCESS); }
public void AddSpellCostModifier(SpellCostModification spellCostModifier) { m_spellCostModifiers.Add(spellCostModifier); }
public override IEnumerator AddSpellCostModifier(SpellCostModification spellCostModifier) { yield return(base.AddSpellCostModifier(spellCostModifier)); }