示例#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
文件: Unit.cs 项目: yowa/Cindeck
 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
文件: Unit.cs 项目: noelex/Cindeck
 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
文件: Unit.cs 项目: noelex/Cindeck
 public bool AlreadyInUnit(OwnedIdol idol)
 {
     return Slots.Any(x => x?.Iid == idol.Iid);
 }
示例#14
0
文件: Unit.cs 项目: noelex/Cindeck
 public bool OccupiedByUnit(OwnedIdol idol)
 {
     return Slots.Any(x => x == idol);
 }
示例#15
0
文件: Unit.cs 项目: noelex/Cindeck
 private int GetVisual(OwnedIdol idol)
 {
     return GetAppeal(idol, AppealType.Visual);
 }
示例#16
0
文件: Unit.cs 项目: noelex/Cindeck
        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
文件: Unit.cs 项目: noelex/Cindeck
 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
文件: Unit.cs 项目: noelex/Cindeck
 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);
        }