public void Damage(int input) { if (input <= 0) { return; } if (null != myDamageEffects) { input = (int)EffectScript.AffectsList( myDamageEffects, null == myUnit ? new Message(new Message.Term(), new Message.Term()) : myUnit.ToMessage(), (float)input); } if (input <= 0) { return; } /*myOwningPlayer.myFrameData.myDamages++; * myOwningPlayer.myTurnData.myFrameData.myDamages++; * myOwningPlayer.myMatchData.myTurnData.myFrameData.myDamages++; * * GlobalScript.ourPlayerFrameData.myDamages++; * GlobalScript.ourPlayerTurnData.myFrameData.myDamages++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myDamages++;*/ myDamage += input; Checkup(); }
// Inserts a card into the hand, // returns false if not successful public bool InsertCard(CardScript input, bool discard = true) { if (null != input) { if (myOwningPlayer) { EffectScript.AffectsList(input.myInsertEffects, myOwningPlayer.ToMessage()); } int cardCount = CountCards(); if (cardCount < myCardCapacity) { input.myHandScript = this; Reanimate(); return(true); } else if (discard) { if (myOwningPlayer) { EffectScript.AffectsList(input.myRemoveEffects, myOwningPlayer.ToMessage()); } } } return(false); }
public PlayerScript Draw(bool destroyOnFailure = true) // If no space in hand, // trigger removal effect // destroy card if specified { CardScript drawCardScript = myDeckScript.RemoveCard(); if (null != drawCardScript) { /*myFrameData.myDraws++; * myTurnData.myFrameData.myDraws++; * myMatchData.myTurnData.myFrameData.myDraws++; * * GlobalScript.ourPlayerFrameData.myDraws++; * GlobalScript.ourPlayerTurnData.myFrameData.myDraws++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myDraws++;*/ // If false, then hand was over capacity, // But the removal effect for the card should go off if (false == myHandScript.InsertCard(drawCardScript)) { EffectScript.AffectsList(drawCardScript.myRemoveEffects, ToMessage()); //failed to draw card so destroy if specified if (destroyOnFailure) { Destroy(drawCardScript.gameObject); } } } return(this); }
public int Cost(Message message) { if (null == myEffects) { return((int)myBase); } else { return((int)EffectScript.AffectsList(myEffects, message, myBase)); } }
// Activates a card public void ActivateCard(CardScript cardScript, Message message) { EffectScript.AffectsList(cardScript.myPlayEffects, message); /*myFrameData.myCardsPlayed++; * myTurnData.myFrameData.myCardsPlayed++; * myMatchData.myTurnData.myFrameData.myCardsPlayed++; * * GlobalScript.ourPlayerFrameData.myCardsPlayed++; * GlobalScript.ourPlayerTurnData.myFrameData.myCardsPlayed++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myCardsPlayed++;*/ switch (cardScript.myType) { case CardScript.Type.Spell: /*myFrameData.mySpellsCast++; * myTurnData.myFrameData.mySpellsCast++; * myMatchData.myTurnData.myFrameData.mySpellsCast++; * * GlobalScript.ourPlayerFrameData.mySpellsCast++; * GlobalScript.ourPlayerTurnData.myFrameData.mySpellsCast++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.mySpellsCast++;*/ break; case CardScript.Type.Item: /*myFrameData.myItemsUsed++; * myTurnData.myFrameData.myItemsUsed++; * myMatchData.myTurnData.myFrameData.myItemsUsed++; * * GlobalScript.ourPlayerFrameData.myItemsUsed++; * GlobalScript.ourPlayerTurnData.myFrameData.myItemsUsed++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myItemsUsed++;*/ break; case CardScript.Type.Unit: /*myFrameData.myUnitsMade++; * myTurnData.myFrameData.myUnitsMade++; * myMatchData.myTurnData.myFrameData.myUnitsMade++; * * GlobalScript.ourPlayerFrameData.myUnitsMade++; * GlobalScript.ourPlayerTurnData.myFrameData.myUnitsMade++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myUnitsMade++;*/ break; } }
public CardScript RemoveCard(CardScript input, bool discard = false) { if (input.transform.IsChildOf(transform)) { input.myHandScript = null; Reanimate(); if (discard) { EffectScript.AffectsList(input.myRemoveEffects, myOwningPlayer.ToMessage()); } return(input); } return(null); }
public void Death() { /*myOwningPlayer.myFrameData.myDeaths++; * myOwningPlayer.myTurnData.myFrameData.myDeaths++; * myOwningPlayer.myMatchData.myTurnData.myFrameData.myDeaths++; * * GlobalScript.ourPlayerFrameData.myDeaths++; * GlobalScript.ourPlayerTurnData.myFrameData.myDeaths++; * GlobalScript.ourPlayerMatchData.myTurnData.myFrameData.myDeaths++;*/ EffectScript.AffectsList(myDeathEffects, ToMessage()); myDeathMessenger.Publish(); myNavMeshAgent.speed = 0f; Destroy(gameObject, 10f); }
//hits something void OnCollisionEnter(Collision collision) { UnitScript unitScript = collision.gameObject.GetComponent <UnitScript>(); if (null == unitScript) { return; } bool deleting = false; if (null == myMessage.mySubject) { } else if (false == mySelfTrigger && unitScript == myMessage.mySubject.myUnitScript) { return; } if (false == myAllyTrigger && unitScript.myOwner == myMessage.mySubject.myPlayerScript) { return; } myMessage.myObject = unitScript.ToTerm(); EffectScript.AffectsList(myHitUnit, myMessage); if (myDeleteOnUnit) { deleting = true; } if (deleting) { Destroy(gameObject); } }