Cindeck.Core.Simulator.GetAppealUpRate C# (CSharp) Method

GetAppealUpRate() private method

private GetAppealUpRate ( IIdol idol, IIdol center, AppealType targetAppeal ) : double
idol IIdol
center IIdol
targetAppeal AppealType
return double
        private double GetAppealUpRate(IIdol idol, IIdol center, 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) &&
                                Unit.Slots.Any(x => x.Category == IdolCategory.Cute) &&
                                Unit.Slots.Any(x => x.Category == IdolCategory.Passion);
                            break;
                        default:
                            break;
                    }

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

            return 0;
        }