Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool HealMonster(int healamount, GameObject card,GameObject source)
- {
- if (!EntityStillValid(card) || !EntityStillValid(source))
- return false;
- //cast animation?
- if (card.GetComponent<MonsterCardAttributes>() != null)
- {
- if ((card.GetComponent<MonsterCardAttributes>().health + healamount) < card.GetComponent<MonsterCardAttributes>().healthmax)
- {
- card.GetComponent<MonsterCardAttributes>().health += healamount;
- }
- else if (card.GetComponent<MonsterCardAttributes>().health < card.GetComponent<MonsterCardAttributes>().healthmax)
- {
- card.GetComponent<MonsterCardAttributes>().health = card.GetComponent<MonsterCardAttributes>().healthmax;
- }
- else
- return true;
- TriggerEvents(card.GetComponent<BaseCardAttributes>().owner.HealEHealed, card);
- TriggerEvents(source.GetComponent<BaseCardAttributes>().owner.HealEHealer, source);
- TriggerEvents(MatchControl.mcontrol.HealEHealed, card);
- TriggerEvents(MatchControl.mcontrol.HealEHealer, source);
- }
- else
- {
- PlayerEntity pe = card.GetComponent<BaseCardAttributes>().owner;
- if (pe.PlayerHP + healamount < pe.PlayerMaxHP)
- {
- pe.PlayerHP += healamount;
- }
- else if (pe.PlayerHP < pe.PlayerMaxHP)
- {
- pe.PlayerHP += pe.PlayerMaxHP;
- }
- else
- return true;
- TriggerEvents(card.GetComponent<BaseCardAttributes>().owner.HealEHealed, card);
- TriggerEvents(source.GetComponent<BaseCardAttributes>().owner.HealEHealer, source);
- TriggerEvents(MatchControl.mcontrol.HealEHealed, card);
- TriggerEvents(MatchControl.mcontrol.HealEHealer, source);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement