Inheritance: IIdol
Exemplo n.º 1
0
        private int CalculateLife(Unit unit, Idol guest)
        {
            if (unit == null)
            {
                return(0);
            }

            var life              = 0;
            var centerEffect      = unit.Center?.CenterEffect is CenterEffect.LifeUp ? (CenterEffect.LifeUp)unit.Center.CenterEffect : null;
            var guestCenterEffect = guest?.CenterEffect is CenterEffect.LifeUp ? (CenterEffect.LifeUp)guest.CenterEffect : null;

            foreach (var idol in unit.Slots.Cast <IIdol>().Concat(Enumerable.Repeat(guest, 1)))
            {
                if (idol == null)
                {
                    continue;
                }

                var rate = 1.0;
                if (centerEffect != null && centerEffect.Targets.HasFlag(idol.Category) == true)
                {
                    rate += centerEffect.Rate;
                }
                if (guestCenterEffect != null && guestCenterEffect.Targets.HasFlag(idol.Category) == true)
                {
                    rate += guestCenterEffect.Rate;
                }
                life += (int)Math.Ceiling(Math.Round(idol.Life * rate, 3));
            }
            return(life);
        }
Exemplo n.º 2
0
 public void UpdateReference(Idol idol)
 {
     if (idol.Iid != Idol.Iid)
     {
         throw new Exception("Cannot update reference to an idol with different IID.");
     }
     Idol = idol;
 }
Exemplo n.º 3
0
 public void UpdateReference(Idol idol)
 {
     if(idol.Iid!=Idol.Iid)
     {
         throw new Exception("Cannot update reference to an idol with different IID.");
     }
     Idol = idol;
 }
Exemplo n.º 4
0
        private int CalculateLife(Unit unit, Idol guest)
        {
            if(unit==null)
            {
                return 0;
            }

            var life = 0;
            var centerEffect = unit.Center?.CenterEffect is CenterEffect.LifeUp ? (CenterEffect.LifeUp)unit.Center.CenterEffect : null;
            var guestCenterEffect = guest?.CenterEffect is CenterEffect.LifeUp ? (CenterEffect.LifeUp)guest.CenterEffect : null;

            foreach (var idol in unit.Slots.Cast<IIdol>().Concat(Enumerable.Repeat(guest,1)))
            {
                if (idol == null) continue;

                var rate = 1.0;
                if (centerEffect!=null && centerEffect.Targets.HasFlag(idol.Category) == true)
                {
                    rate += centerEffect.Rate;
                }
                if (guestCenterEffect != null && guestCenterEffect.Targets.HasFlag(idol.Category) == true)
                {
                    rate += guestCenterEffect.Rate;
                }
                life += (int)Math.Ceiling(idol.Life * rate);
            }
            return life;
        }
Exemplo n.º 5
0
 public OwnedIdol(int lid, Idol idol, int skillLevel = 10)
 {
     Oid        = lid;
     Idol       = idol;
     SkillLevel = skillLevel;
 }
Exemplo n.º 6
0
 public OwnedIdol(int lid, Idol idol, int skillLevel=10)
 {
     Oid = lid;
     Idol = idol;
     SkillLevel = skillLevel;
 }
Exemplo n.º 7
-1
        private double GetAppealUpRate(IIdol idol, IIdol center, Idol guest, AppealType targetAppeal)
        {
            var effect = center?.CenterEffect;

            if (effect != null && Unit != null)
            {
                if (effect is CenterEffect.AppealUp)
                {
                    var e = effect as CenterEffect.AppealUp;
                    if (e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(targetAppeal) == true)
                    {
                        return(e.Rate);
                    }
                }
                else if (effect is CenterEffect.ConditionalAppealUp)
                {
                    var e = effect as CenterEffect.ConditionalAppealUp;
                    var conditionFulfilled = false;
                    switch (e.Condition)
                    {
                    case AppealUpCondition.UnitContainsAllTypes:
                        conditionFulfilled = (Unit.Slots.Any(x => x.Category == IdolCategory.Cool) || (Guest?.Category == IdolCategory.Cool)) &&
                                             (Unit.Slots.Any(x => x.Category == IdolCategory.Cute) || (Guest?.Category == IdolCategory.Cute)) &&
                                             (Unit.Slots.Any(x => x.Category == IdolCategory.Passion) || (Guest?.Category == IdolCategory.Passion));
                        break;

                    default:
                        break;
                    }

                    if (conditionFulfilled && e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(targetAppeal) == true)
                    {
                        return(e.Rate);
                    }
                }
            }

            return(0);
        }