Пример #1
0
        public virtual void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            OnInvoked?.Invoke();

            //PerformAnimation(source, target);
            source.OnTriggerAnimation(PerformAnimation, target);
        }
Пример #2
0
        public override void ApplyStatus(MingmingBattleLogic mingming, int count)
        {
            int currentCount = mingming.GetStatusCount(this);
            int _count       = Mathf.Clamp(count, count, maxCount - currentCount);

            base.ApplyStatus(mingming, _count);
        }
Пример #3
0
 public override void DoEffect(MingmingBattleLogic mingming)
 {
     if (constraint.MingmingMeetsConstraint(mingming))
     {
         action.InvokeAction(mingming, mingming, alignment);
     }
 }
Пример #4
0
        public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            int healAmount = Rules.GetHealAmount(source, target, HealPower);

            target.TakeDamage(-healAmount, source);

            base.InvokeAction(source, target, cardAlignment);
        }
Пример #5
0
        public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            float damage = Rules.Instance.GetAttackDamage(source, target, cardAlignment, AttackPower);

            target.TakeDamage(Mathf.FloorToInt(damage), source);

            base.InvokeAction(source, target, cardAlignment);
        }
Пример #6
0
        public override void DoEffect(MingmingBattleLogic mingming)
        {
            int count = mingming.GetStatusCount(this);
            int dmg   = GetDamage(mingming.TotalHealth, count);

            mingming.TakeDamage(dmg, null);
            UserMessage.Instance.SendMessageToUser($"{mingming.Name} took {dmg} {GetTooltipHeader(count)} damage");
        }
Пример #7
0
        public override void InvokeAction(CardAction cardAction, MingmingBattleLogic source, MingmingBattleLogic target, Card card)
        {
            var controller = FindObjectsOfType <PartyController>().First(m => m.HasMingming(target)); //should never be null

            foreach (var mingming in controller.Mingmings.Where(m => m.IsInPlay))
            {
                cardAction.InvokeAction(source, mingming.Logic, card.CardAlignment);
            }
        }
        public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            OnInvoked?.Invoke();

            if (Constraint.MingmingMeetsConstraint(source))
            {
                Action.InvokeAction(source, target, cardAlignment);
            }
        }
Пример #9
0
        public override void DoEffect(MingmingBattleLogic mingming)
        {
            int count = mingming.GetStatusCount(this);

            if (count > 1)
            {
                UserMessage.Instance.SendMessageToUser($"{mingming.Name} is {name} for {count} more turn(s)");
            }
            mingming.ApplyStatus(this, -1);
        }
Пример #10
0
        public virtual bool CanUseCard(MingmingBattleLogic source, Card card)
        {
            bool hasEnergy = source.EnergyAvailable >= card.EnergyCost;

            if (!hasEnergy)
            {
                UserMessage.Instance.SendMessageToUser($"{source.Name} does not have the required energy. Needs {card.EnergyCost}");
            }
            return(hasEnergy && MingmingMeetsConstraint(source));
        }
Пример #11
0
        public override bool MingmingMeetsConstraint(MingmingBattleLogic source)
        {
            bool MeetsStatusConstraint = source.HasStatus(StatusConstraint.Status) == StatusConstraint.HasStatus;

            if (!MeetsStatusConstraint)
            {
                string canHave = StatusConstraint.HasStatus ? "MUST" : "CANNOT";
                UserMessage.Instance.SendMessageToUser($"{source.Name} {canHave} have the status: {StatusConstraint.Status.name}");
            }

            return(MeetsStatusConstraint);
        }
Пример #12
0
        public override bool MingmingMeetsConstraint(MingmingBattleLogic source)
        {
            bool meetsStatusConstraint = StatusConstraints.All(sc => source.HasStatus(sc.Status) == sc.HasStatus);

            if (!meetsStatusConstraint)
            {
                var    statusConstraint = StatusConstraints.FirstOrDefault(sc => source.HasStatus(sc.Status) != sc.HasStatus);
                string canHave          = statusConstraint.HasStatus ? "MUST" : "CANNOT";
                UserMessage.Instance.SendMessageToUser($"{source.Name} {canHave} have the status: {statusConstraint.Status.name}");
            }

            return(meetsStatusConstraint);
        }
Пример #13
0
        public int GetAttackDamage(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment, float power)
        {
            float _modifier = GetModifier(source.GetMingmingAlignment, target.GetMingmingAlignment, cardAlignment);

            float damage = GetLevelModifier(source.Level);

            damage *= (float)power * source.Attack / target.Defense;
            damage  = (float)(damage / 40) + 2;

            //Debug.Log($"{source.name} {source.GetInstanceID()} attacks {target.name} {target.GetInstanceID()} for {damage} damage.\nModifier: {_modifier}");
            damage *= _modifier;

            return(Mathf.FloorToInt(damage));
        }
Пример #14
0
        public override void ApplyStatus(MingmingBattleLogic mingming, int count)
        {
            var value       = (float)ModifierProperty.GetValue(mingming);
            var changeValue = Modifier * Mathf.Abs(count);

            base.ApplyStatus(mingming, count);
            if (count > 0)
            {
                ModifierProperty.SetValue(mingming, value * changeValue);
            }
            else
            {
                ModifierProperty.SetValue(mingming, value / changeValue);
            }
        }
Пример #15
0
 public virtual void RemoveStatus(MingmingBattleLogic mingming)
 {
     mingming.RemoveStatus(this);
 }
Пример #16
0
 public bool CanUseCard(MingmingBattleLogic source) => !PlayedThisTurn && Data.CardConstraint.CanUseCard(source, this);
Пример #17
0
 public virtual void ApplyStatus(MingmingBattleLogic mingming, int count)
 {
     mingming.ApplyStatus(this, count);
 }
Пример #18
0
        public static int GetHealAmount(MingmingBattleLogic source, MingmingBattleLogic target, float power)
        {
            float healAmount = GetLevelModifier(source.Level) * power * source.Attack / 2;

            return(Mathf.FloorToInt(Mathf.Clamp(healAmount, 0, target.TotalHealth - target.CurrentHealth)));
        }
Пример #19
0
 public IEnumerator InvokeActions(MingmingBattleLogic source, MingmingBattleLogic target) => Data.InvokeActionCoroutine(source, target, this);
Пример #20
0
 public override void DoEffect(MingmingBattleLogic mingming)
 {
     base.DoEffect(mingming);
     mingming.ApplyStatus(this, -1);
 }
Пример #21
0
 public virtual bool MingmingMeetsConstraint(MingmingBattleLogic source) => true;
Пример #22
0
        public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            FindObjectsOfType <PartyController>().First(m => m.HasMingming(source)).DrawCards(numberOfCards);

            base.InvokeAction(source, target, cardAlignment);
        }
Пример #23
0
 public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
 {
     //TODO add card alignment modifier?
     target.AddEnergy(EnergyAdded);
     base.InvokeAction(source, target, cardAlignment);
 }
Пример #24
0
        public static int GetCurrentStateScore(this MingmingBattleLogic mingming)
        {
            int statusScore = mingming.GetStatuses().Aggregate(0, (score, pair) => score += pair.Key.GetScore(pair.Value));

            return(mingming.CurrentHealth * 2 + statusScore);
        }
Пример #25
0
        public override void InvokeAction(MingmingBattleLogic source, MingmingBattleLogic target, CardAlignment cardAlignment)
        {
            Status.RemoveStatus(target);

            base.InvokeAction(source, target, cardAlignment);
        }
Пример #26
0
 public override void DoEffect(MingmingBattleLogic mingming)
 {
 }
Пример #27
0
 public Mingming GetMingming(MingmingBattleLogic logic)
 {
     return(Mingmings[logic.Id]);
 }
Пример #28
0
 public abstract void DoEffect(MingmingBattleLogic mingming);
Пример #29
0
 public override void InvokeAction(CardAction cardAction, MingmingBattleLogic source, MingmingBattleLogic target, Card card)
 {
     cardAction.InvokeAction(source, target, card.CardAlignment);
 }
Пример #30
0
 public override void RemoveStatus(MingmingBattleLogic mingming)
 {
     ModifierProperty.SetValue(mingming, 1);
     base.RemoveStatus(mingming);
 }