Ejemplo n.º 1
0
        public static PartyMember[] GetAllTargetsForAbilityStep(PartyMember source, PartyMember primaryTarget, AbilityTarget abilityTarget, AbilityStep abilityStep)
        {
            var menu = MenuModel.Instance;

            var targets = new List<PartyMember> { primaryTarget };

            if (abilityTarget == AbilityTarget.AllFriendly)
            {
                //apply to all party members
                targets.AddRange(new[]
                {
                    GameModel.Instance.PartyMember1,
                    GameModel.Instance.PartyMember2,
                    GameModel.Instance.PartyMember3,
                    GameModel.Instance.PartyMember4
                });
            }
            else if (abilityTarget == AbilityTarget.AnySingleDefaultFriendlyWithSecondaryTargets ||
                     abilityTarget == AbilityTarget.AnySingleDefaultHostileWithSecondaryTargets ||
                     abilityTarget == AbilityTarget.SingleFriendlyWithSecondaryTargets)
            {
                targets.AddRange(abilityStep
                    .GetSecondaryTargets(source, primaryTarget, null)
                    .Select(x => x as PartyMember));
            }

            return targets.Where(x => x != null).Distinct().ToArray();
        }
 public static Boolean HasTwoHandedWeaponEquipped(PartyMember partyMember)
 {
     return partyMember.EquipmentLayout.WeaponEquipType == Enums.WeaponEquipType.TwoHandedWeapon
         && (partyMember.EquipmentLeftHand != null || partyMember.EquipmentRightHand != null);
 }
Ejemplo n.º 3
0
 public static SavedPartyMemberData FromModel(PartyMember model)
 {
     return new SavedPartyMemberData
     {
         Id = model.Id,
         Health = model.CurrentHealth,
         Energy = model.CurrentEnergy,
         Name = model.Name,
         Experience = model.CurrentExperience,
         AbilityExperienceByType = model.CurrentGiftTypeExperienceById.ToDictionary(x => x.Key, x => x.Value),
         LeftHandEquipmentId = model.EquipmentLeftHand?.Id,
         RightHandEquipmentId = model.EquipmentRightHand?.Id,
         HelmEquipmentId = model.EquipmentHelm?.Id,
         ArmorEquipmentId = model.EquipmentArmor?.Id,
         Trinket1EquipmentId = model.EquipmentTrinket1?.Id,
         Trinket2EquipmentId = model.EquipmentTrinket2?.Id,
         Power1Unlocked = model.PowerSet.Power1.IsUnlocked,
         Power2Unlocked = model.PowerSet.Power2.IsUnlocked,
         Power3Unlocked = model.PowerSet.Power3.IsUnlocked,
         BaseVitality = model.Stats.BaseVitality,
         BaseFocus = model.Stats.BaseFocus,
         BaseStrength = model.Stats.BaseStrength,
         BaseWill = model.Stats.BaseWill,
         BaseDexterity = model.Stats.BaseDexterity,
         BaseKnowledge = model.Stats.BaseKnowledge,
         BaseSpeed = model.Stats.BaseSpeed,
         BaseLuck = model.Stats.BaseLuck,
         Level = model.Stats.Level,
         MaxHealth = model.Stats.MaxHealth,
         MaxEnergy = model.Stats.MaxEnergy,
     };
 }
Ejemplo n.º 4
0
 public PartyMember CloneForStatPreview()
 {
     var clone = new PartyMember(Id, PowerSet, Stats.CloneForStatPreview(), BattleLogic as PartyMemberBattleLogic, EquipmentLayout);
     clone.CurrentExperience = CurrentExperience;
     clone.CurrentGiftTypeExperienceById = CurrentGiftTypeExperienceById;
     clone.Buffs = new ObservableCollection<Buff>(Buffs);
     foreach (var equip in Equipment)
     {
         clone.Equip(equip.Value, equip.Key, false);
     }
     return clone;
 }
 public static void SetPartyMemberStatBinding(PartyMember source, DependencyProperty targetProperty, BattleEntityStatCalculationData calculationData)
 {
     var statBinding = GetStatBinding(source, calculationData);
     BindingOperations.SetBinding(source.Stats, targetProperty, statBinding);
 }
Ejemplo n.º 6
0
 public static Int32 CalculatePartyMemberSkillAttackDamage(PartyMember partyMember, Double sourceDamage, Boolean isCrit)
 {
     return GetDamage(partyMember.Stats.SkillPower, partyMember.Stats.Will, partyMember.Stats.Level, sourceDamage, partyMember.Stats.Luck, isCrit);
 }
Ejemplo n.º 7
0
 public static Int32 CalculatePartyMemberBasicAttackDamage(PartyMember partyMember, Double sourceDamage, Boolean isCrit)
 {
     return GetDamage(partyMember.Stats.AttackPower, partyMember.Stats.Strength, partyMember.Stats.Level, sourceDamage, partyMember.Stats.Luck, isCrit);
 }
Ejemplo n.º 8
0
 public static PartyMemberInBattle New(PartyMember partyMember)
 {
     return new PartyMemberInBattle(partyMember);
 }
Ejemplo n.º 9
0
        protected PartyMemberInBattle(PartyMember partyMember) : base(partyMember)
        {
            SpriteSheet = PartyMemberSpriteSheet.New(partyMember.Id);

            SpriteSheet.Look(SpriteDirection.Left); //TODO: Remove?
        }
Ejemplo n.º 10
0
 public static BattleData New(PartyMember partyMember1, PartyMember partyMember2, PartyMember partyMember3, PartyMember partyMember4,
     EnemyLayout enemyLayout)
 {
     return new BattleData(partyMember1, partyMember2, partyMember3, partyMember4, enemyLayout);
 }
Ejemplo n.º 11
0
 private static PartyMemberInBattle CreatePartyMemberInBattle(PartyMember partyMember) =>
     partyMember == null ? null : PartyMemberInBattle.New(partyMember);
Ejemplo n.º 12
0
        protected BattleData(PartyMember partyMember1, PartyMember partyMember2, PartyMember partyMember3, PartyMember partyMember4,
            EnemyLayout enemyLayout)
        {
            PartyMemberInBattle1 = CreatePartyMemberInBattle(partyMember1);
            PartyMemberInBattle2 = CreatePartyMemberInBattle(partyMember2);
            PartyMemberInBattle3 = CreatePartyMemberInBattle(partyMember3);
            PartyMemberInBattle4 = CreatePartyMemberInBattle(partyMember4);

            Enemies = CreateEnemiesInBattle(enemyLayout);

            //wire up the 6 helper properties for party members/enemies/battle entities in battle/alive
            var allPartyMembersInBattleBinding = new MultiBinding { Converter = new BattlefieldDataAllPartyMembersInBattleConverter() };
            allPartyMembersInBattleBinding.Bindings.Add(new Binding("PartyMemberInBattle1") { Source = this });
            allPartyMembersInBattleBinding.Bindings.Add(new Binding("PartyMemberInBattle2") { Source = this });
            allPartyMembersInBattleBinding.Bindings.Add(new Binding("PartyMemberInBattle3") { Source = this });
            allPartyMembersInBattleBinding.Bindings.Add(new Binding("PartyMemberInBattle4") { Source = this });
            BindingOperations.SetBinding(this, AllPartyMembersInBattleProperty, allPartyMembersInBattleBinding);

            var allEnemiesInBattleBinding = new Binding("Enemies") { Source = this, Converter = new BattlefieldDataAllEnemiesInBattleConverter() };
            BindingOperations.SetBinding(this, AllEnemiesInBattleProperty, allEnemiesInBattleBinding);

            var allAlivePartyMembersInBattleBinding = new MultiBinding { Converter = new BattlefieldDataAllAliveBattleEntitiesInBattleConverter<PartyMemberInBattle>() };
            allAlivePartyMembersInBattleBinding.Bindings.Add(new Binding("AllPartyMembersInBattle") { Source = this });
            allAlivePartyMembersInBattleBinding.Bindings.Add(new Binding("IsAlive") { Source = PartyMemberInBattle1 });
            allAlivePartyMembersInBattleBinding.Bindings.Add(new Binding("IsAlive") { Source = PartyMemberInBattle2 });
            allAlivePartyMembersInBattleBinding.Bindings.Add(new Binding("IsAlive") { Source = PartyMemberInBattle3 });
            allAlivePartyMembersInBattleBinding.Bindings.Add(new Binding("IsAlive") { Source = PartyMemberInBattle4 });
            BindingOperations.SetBinding(this, AllAlivePartyMembersInBattleProperty, allAlivePartyMembersInBattleBinding);

            var allAliveEnemiesInBattleBinding = new MultiBinding { Converter = new BattlefieldDataAllAliveBattleEntitiesInBattleConverter<EnemyInBattle>() };
            allAliveEnemiesInBattleBinding.Bindings.Add(new Binding("AllEnemiesInBattle") { Source = this });
            foreach (var enemy in AllEnemiesInBattle)
            {
                allAliveEnemiesInBattleBinding.Bindings.Add(new Binding("IsAlive") { Source = enemy });
            }
            BindingOperations.SetBinding(this, AllAliveEnemiesInBattleProperty, allAliveEnemiesInBattleBinding);

            var allBattleEntitiesInBattleBinding = new MultiBinding { Converter = new BattlefieldDataBattleEntitiesInBattleConverter() };
            allBattleEntitiesInBattleBinding.Bindings.Add(new Binding("AllPartyMembersInBattle") { Source = this });
            allBattleEntitiesInBattleBinding.Bindings.Add(new Binding("AllEnemiesInBattle") { Source = this });
            BindingOperations.SetBinding(this, AllBattleEntitiesInBattleProperty, allBattleEntitiesInBattleBinding);

            var allAliveBattleEntitiesInBattleBinding = new MultiBinding { Converter = new BattlefieldDataBattleEntitiesInBattleConverter() };
            allAliveBattleEntitiesInBattleBinding.Bindings.Add(new Binding("AllAlivePartyMembersInBattle") { Source = this });
            allAliveBattleEntitiesInBattleBinding.Bindings.Add(new Binding("AllAliveEnemiesInBattle") { Source = this });
            BindingOperations.SetBinding(this, AllAliveBattleEntitiesInBattleProperty, allAliveBattleEntitiesInBattleBinding);

            //once the bindings are established...
            _actionMultiplier = CalculateActionMultiplier();
        }
Ejemplo n.º 13
0
 public static Int32 GetPartyMemberIndex(PartyMember partyMember)
 {
     if (partyMember == GameModel.Instance.PartyMember1) { return 0; }
     if (partyMember == GameModel.Instance.PartyMember2) { return 1; }
     if (partyMember == GameModel.Instance.PartyMember3) { return 2; }
     if (partyMember == GameModel.Instance.PartyMember4) { return 3; }
     return Constants.MENU_NO_SELECTION;
 }
Ejemplo n.º 14
0
        public static List<DelayedAction> GetAbilityExecutionSteps(Ability ability, PartyMember source, PartyMember primaryTarget)
        {
            var toReturn = new List<DelayedAction>();
            
            //for each ability step
            foreach (var step in ability.GetAbilitySteps(source))
            {
                var allTargets = new PartyMember[0];

                toReturn.Add(DelayedAction.New(() =>
                {
                    //get secondary targets for this step based on primary target
                    allTargets = GetAllTargetsForAbilityStep(source, primaryTarget, ability.Target, step);
                }, 1));

                //handle ability animations (in parallel)
                toReturn.Add(DelayedAction.New(
                    () => HandleAbilityStepAnimations(source, allTargets, step.Animation), step.GetTotalFrames(GameState.InMenu)));

                //apply effects to targets, long enough to display healing/status/etc
                toReturn.Add(DelayedAction.New(
                    () => step.ApplyEffectToTargets(null, allTargets), Constants.BATTLE_TIMING_DISPLAY_DAMAGE_TICKS));
            }
            return toReturn;
        }
Ejemplo n.º 15
0
        public static void HandleAbilityStepAnimations(PartyMember source, PartyMember[] targets, AbilityAnimation animation)
        {
            //TODO: AbilityStepAnimation InMenu OverSource/UnderSource/OverTarget/UnderTarget Visuals
            if (animation.OverSourceVisual != AbilityVisual.None)
            {

            }
            if (animation.UnderSourceVisual != AbilityVisual.None)
            {

            }
            if (animation.OverTargetVisual != AbilityVisual.None)
            {
                foreach (var target in targets)
                {

                }
            }
            if (animation.UnderTargetVisual != AbilityVisual.None)
            {
                foreach (var target in targets)
                {

                }
            }
        }