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); }
public void UpdateReference(Idol idol) { if (idol.Iid != Idol.Iid) { throw new Exception("Cannot update reference to an idol with different IID."); } Idol = idol; }
public void UpdateReference(Idol idol) { if(idol.Iid!=Idol.Iid) { throw new Exception("Cannot update reference to an idol with different IID."); } Idol = idol; }
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; }
public OwnedIdol(int lid, Idol idol, int skillLevel = 10) { Oid = lid; Idol = idol; SkillLevel = skillLevel; }
public OwnedIdol(int lid, Idol idol, int skillLevel=10) { Oid = lid; Idol = idol; SkillLevel = skillLevel; }
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); }