Пример #1
0
        private string GetSkillSummary(OwnedIdol idol)
        {
            if(idol==null)
            {
                return "編成されていません\r\n\r\n";
            }

            var name= string.Format("{0}[{1}]{2}({3})\r\n", string.IsNullOrEmpty(idol.Label) ? "" : string.Format("[{0}]", idol.Label),
                idol.Rarity.ToLocalizedString(), idol.Name,
                idol.Skill == null ? "特技なし" : string.Format("{0}Lv{1}", idol.Skill.Name, idol.SkillLevel));
            var skillEffect = idol.Skill == null ? "・" : GetSkillEffect(idol.Skill)+ "・";
            var skillDetail = idol.Skill == null ? "" : GetSkillDetails(idol.Skill, idol.SkillLevel);
            if(SimulationResult==null)
            {
                return name + skillEffect + skillDetail;
            }
            else
            {
                string triggerDetail = "";
                if (idol.Skill != null)
                {
                    int triggered = m_triggeredSkills.ContainsKey(idol.Oid) ? m_triggeredSkills[idol.Oid].Length : 0;
                    int expected = (int)Math.Floor((SimulationResult.Duration - 1.0) / idol.Skill.Interval);
                    triggerDetail = $"{triggered}/{expected}回発動({((double)triggered / expected):P1})";
                }
                return name + skillEffect + skillDetail + "\r\n" + triggerDetail;
            }
        }
Пример #2
0
        private int GetLife(OwnedIdol idol)
        {
            if (idol == null)
            {
                return(0);
            }
            var effect = Center?.CenterEffect as CenterEffect.LifeUp;

            if (effect?.Targets.HasFlag(idol.Category) == true)
            {
                return((int)Math.Ceiling(Math.Round(idol.Life + idol.Life * effect.Rate, 3)));
            }
            return(idol.Life);
        }
Пример #3
0
 public void RemoveIdol(OwnedIdol idol)
 {
     if (Slot1 == idol)
     {
         Slot1 = null;
     }
     if (Slot2 == idol)
     {
         Slot2 = null;
     }
     if (Slot3 == idol)
     {
         Slot3 = null;
     }
     if (Slot4 == idol)
     {
         Slot4 = null;
     }
     if (Slot5 == idol)
     {
         Slot5 = null;
     }
 }
Пример #4
0
        private double GetSkillTriggerProbability(OwnedIdol idol, IIdol center, IIdol guestCenter, Song song)
        {
            if (idol == null || idol.Skill == null)
            {
                return(0);
            }
            var rate = idol.Skill.EstimateProbability(idol.SkillLevel);

            if (center != null && center.CenterEffect is CenterEffect.SkillTriggerProbabilityUp)
            {
                var e = center.CenterEffect as CenterEffect.SkillTriggerProbabilityUp;
                rate *= 1 + (e.Targets.HasFlag(idol.Category) ? e.Rate : 0);
            }
            if (guestCenter != null && guestCenter.CenterEffect is CenterEffect.SkillTriggerProbabilityUp)
            {
                var e = guestCenter.CenterEffect as CenterEffect.SkillTriggerProbabilityUp;
                rate *= 1 + (e.Targets.HasFlag(idol.Category) ? e.Rate : 0);
            }
            if (song != null && song.Type.HasFlag(idol.Category))
            {
                rate *= 1.3;
            }
            return(Math.Min(rate, 1.0));
        }
Пример #5
0
 public bool OccupiedByUnit(OwnedIdol idol)
 {
     return(Slots.Any(x => x == idol));
 }
Пример #6
0
 public bool AlreadyInUnit(OwnedIdol idol)
 {
     return(Slots.Any(x => x?.Iid == idol.Iid));
 }
Пример #7
0
 private int GetVisual(OwnedIdol idol)
 {
     return(GetAppeal(idol, AppealType.Visual));
 }
Пример #8
0
 private int GetDance(OwnedIdol idol)
 {
     return(GetAppeal(idol, AppealType.Dance));
 }
Пример #9
0
 private double GetSkillTriggerProbability(OwnedIdol idol, IIdol center, IIdol guestCenter, Song song)
 {
     if (idol == null || idol.Skill == null)
     {
         return 0;
     }
     var rate = idol.Skill.EstimateProbability(idol.SkillLevel);
     if (center != null && center.CenterEffect is CenterEffect.SkillTriggerProbabilityUp)
     {
         var e = center.CenterEffect as CenterEffect.SkillTriggerProbabilityUp;
         rate *= 1+(e.Targets.HasFlag(idol.Category) ? e.Rate : 0);
     }
     if (guestCenter != null && guestCenter.CenterEffect is CenterEffect.SkillTriggerProbabilityUp)
     {
         var e = guestCenter.CenterEffect as CenterEffect.SkillTriggerProbabilityUp;
         rate *= 1+(e.Targets.HasFlag(idol.Category) ? e.Rate : 0);
     }
     if (song != null && song.Type.HasFlag(idol.Category))
     {
         rate *= 1.3;
     }
     return Math.Min(rate, 1.0);
 }
Пример #10
0
 private int GetVocal(OwnedIdol idol)
 {
     if (idol == null)
     {
         return 0;
     }
     var effect = Center?.CenterEffect as CenterEffect.AppealUp;
     if (effect?.Targets.HasFlag(idol.Category) == true && effect?.TargetAppeal.HasFlag(AppealType.Vocal) == true)
     {
         return (int)Math.Ceiling(idol.Vocal + idol.Vocal * effect.Rate);
     }
     return idol.Vocal;
 }
Пример #11
0
 public void RemoveIdol(OwnedIdol idol)
 {
     if (Slot1 == idol) Slot1 = null;
     if (Slot2 == idol) Slot2 = null;
     if (Slot3 == idol) Slot3 = null;
     if (Slot4 == idol) Slot4 = null;
     if (Slot5 == idol) Slot5 = null;
 }
Пример #12
0
        private void DrawTimeline(Canvas c, OwnedIdol idol)
        {
            c.Children.Clear();
            if (idol==null||idol.Skill==null||c.ActualHeight==0)
            {
                return;
            }
            double interval = idol.Skill.Interval;
            var duration = idol.Skill.EstimateDuration(idol.SkillLevel);
            var playTime = (SimulationResult==null? 120:SimulationResult.Duration)-1;
            var triggerCount = (int)Math.Floor( playTime / interval);
            var totalWidth = c.ActualWidth;
            var skillWidth = (duration / playTime) * totalWidth;
            var intervalWidth = (interval / playTime) * totalWidth;
            var brush = GetBrushBySkill(idol.Skill);
            var disabled = new SolidColorBrush(Colors.LightGray);
            bool notAvail;
            for (int i = 1; i <= triggerCount; i++)
            {
                double left = i * intervalWidth;
                double right = left + skillWidth;

                if (right > c.ActualWidth && skillWidth < (right - c.ActualWidth))
                {
                    break;
                }

                notAvail = SimulationResult != null && !(m_triggeredSkills.ContainsKey(idol.Oid) && m_triggeredSkills[idol.Oid].Any(x => x.Since == i * interval));

                var rect = new Rectangle
                {
                    Fill = notAvail? disabled : brush,
                    Width = right > c.ActualWidth ? skillWidth - (right - c.ActualWidth) : skillWidth,
                    Height = c.ActualHeight,
                    Opacity = 1
                };
                if (rect.Width < 5)
                {
                    left -= 5-rect.Width;
                    rect.Width = 5;
                }
                Canvas.SetLeft(rect, left);
                Canvas.SetTop(rect, 0);
                c.Children.Add(rect);
            }
        }
Пример #13
0
 public bool AlreadyInUnit(OwnedIdol idol)
 {
     return Slots.Any(x => x?.Iid == idol.Iid);
 }
Пример #14
0
 public bool OccupiedByUnit(OwnedIdol idol)
 {
     return Slots.Any(x => x == idol);
 }
Пример #15
0
 private int GetVisual(OwnedIdol idol)
 {
     return GetAppeal(idol, AppealType.Visual);
 }
Пример #16
0
        private int GetAppeal(OwnedIdol idol,AppealType type)
        {
            if (idol == null)
            {
                return 0;
            }

            var effect = Center?.CenterEffect;
            var rawValue= (int)idol.GetType().GetProperty(type.ToString()).GetValue(idol);
            if (effect != null)
            {
                if (effect is CenterEffect.AppealUp)
                {
                    var e = effect as CenterEffect.AppealUp;
                    if (e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(type) == true)
                    {
                        return (int)Math.Ceiling(Math.Round(rawValue + rawValue * e.Rate, 3));
                    }
                }
                else if(effect is CenterEffect.ConditionalAppealUp)
                {
                    var e = effect as CenterEffect.ConditionalAppealUp;
                    var conditionFulfilled = false;
                    switch (e.Condition)
                    {
                        case AppealUpCondition.UnitContainsAllTypes:
                            conditionFulfilled = Slots.Any(x => x.Category == IdolCategory.Cool) && 
                                Slots.Any(x => x.Category == IdolCategory.Cute) && 
                                Slots.Any(x => x.Category == IdolCategory.Passion);
                            break;
                        default:
                            break;
                    }

                    if (conditionFulfilled && e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(type) == true)
                    {
                        return (int)Math.Ceiling(Math.Round(rawValue + rawValue * e.Rate, 3));
                    }
                }
            }

            return rawValue;
        }
Пример #17
0
 private int GetLife(OwnedIdol idol)
 {
     if(idol==null)
     {
         return 0;
     }
     var effect = Center?.CenterEffect as CenterEffect.LifeUp;
     if (effect?.Targets.HasFlag(idol.Category) == true)
     {
         return (int)Math.Ceiling(Math.Round(idol.Life + idol.Life * effect.Rate, 3));
     }
     return idol.Life;
 }
Пример #18
0
 private int GetDance(OwnedIdol idol)
 {
     return GetAppeal(idol, AppealType.Dance);
 }
Пример #19
0
 public void RemoveIdolFromUnits(OwnedIdol idol)
 {
     TemporalUnit.RemoveIdol(idol);
     foreach(var x in Units)
     {
         x.RemoveIdol(idol);
     }
 }
Пример #20
0
 public bool IsIdolInUse(OwnedIdol idol)
 {
     return TemporalUnit.OccupiedByUnit(idol) || m_config.Units.Any(x => x.OccupiedByUnit(idol));
 }
Пример #21
0
 public void DeleteOwnedIdol(OwnedIdol idol)
 {
     m_config.OwnedIdols.Remove(idol);
     m_mvm.Units.RemoveIdolFromUnits(idol);
 }
Пример #22
0
 private void UnregisterProperptyChanged(OwnedIdol idol)
 {
     if (idol != null)
     {
         (idol as INotifyPropertyChanged).PropertyChanged -= SkillTimeline_PropertyChanged;
     }
 }
Пример #23
-1
        private int GetAppeal(OwnedIdol idol, AppealType type)
        {
            if (idol == null)
            {
                return(0);
            }

            var effect   = Center?.CenterEffect;
            var rawValue = (int)idol.GetType().GetProperty(type.ToString()).GetValue(idol);

            if (effect != null)
            {
                if (effect is CenterEffect.AppealUp)
                {
                    var e = effect as CenterEffect.AppealUp;
                    if (e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(type) == true)
                    {
                        return((int)Math.Ceiling(Math.Round(rawValue + rawValue * e.Rate, 3)));
                    }
                }
                else if (effect is CenterEffect.ConditionalAppealUp)
                {
                    var e = effect as CenterEffect.ConditionalAppealUp;
                    var conditionFulfilled = false;
                    switch (e.Condition)
                    {
                    case AppealUpCondition.UnitContainsAllTypes:
                        conditionFulfilled = Slots.Any(x => x.Category == IdolCategory.Cool) &&
                                             Slots.Any(x => x.Category == IdolCategory.Cute) &&
                                             Slots.Any(x => x.Category == IdolCategory.Passion);
                        break;

                    default:
                        break;
                    }

                    if (conditionFulfilled && e.Targets.HasFlag(idol.Category) == true && e.TargetAppeal.HasFlag(type) == true)
                    {
                        return((int)Math.Ceiling(Math.Round(rawValue + rawValue * e.Rate, 3)));
                    }
                }
            }

            return(rawValue);
        }