public void CheckCardEffects(EffectExecutionTime thisExecutionTime, IFieldCard optionalSecondCard = null, IDORGridSpot optionalBattlingTerrain = null, bool checkEndEffects = false) { if (p_ThisCardRenderer.p_CardToRender is DOREffectMonsterCard) { DOREffectMonsterCard asEffectMonster = (DOREffectMonsterCard)p_ThisCardRenderer.p_CardToRender; //Debug.Log($"Checking {asEffectMonster.Effects.Count} effects for effects that can be triggered during /{thisExecution}/"); foreach (IDORCardEffect effect in asEffectMonster.p_CardEffects) { if (effect == null) { //Debug.LogError("Effect was null in list?"); continue; } if (effect.p_When.HasFlag(thisExecutionTime)) { bool canExecute = effect.CardEffect_CanPerformEffect(this); if (checkEndEffects || canExecute == false) { effect.CardEffect_EndEffect(this, p_ThisGridSpot.p_Parent, optionalSecondCard, optionalBattlingTerrain); } else { // TODO: Notify for animating the effect effect.CardEffect_Perform(this, p_ThisGridSpot.p_Parent, optionalSecondCard, optionalBattlingTerrain); } } } } }
public void ApplyBonusAttack(int amount, IFieldCard cardApplyingEffect) { if (!p_FieldCardIDsAffectingThisCard.Contains(cardApplyingEffect.p_UniqueID)) { p_FieldCardIDsAffectingThisCard.Add(cardApplyingEffect.p_UniqueID); p_BonusAttack += amount; } }
public void RemoveBonusAttack(int amount, IFieldCard cardApplyingEffect) { if (p_FieldCardIDsAffectingThisCard.Contains(cardApplyingEffect.p_UniqueID)) { p_FieldCardIDsAffectingThisCard.Add(cardApplyingEffect.p_UniqueID); p_BonusAttack -= amount; p_FieldCardIDsAffectingThisCard.RemoveAll((x) => x == cardApplyingEffect.p_UniqueID); } }