Beispiel #1
0
 public AttackDescription(LivingEntity ent,
                          bool withVariation    = true,
                          AttackKind attackKind = AttackKind.Unset,//if uset it will be based on current weapon/active fi
                          OffensiveSpell spell  = null)
 {
     fightItem = null;
     Calc(ent, withVariation, ref attackKind, spell);
 }
Beispiel #2
0
    public Netero() : base("Netero")
    {
        Spell palmOfBuddha = new OffensiveSpell(stats, 20f, "Palm of Buddha");
        Spell nen          = new EffectSpell(stats, new PhysicalAttack(25f, 5), 10f, "Nen");
        Spell rdef         = new EffectSpell(stats, new ReduceDefense(25f, 2), 10f, "Reduce Defense");
        Spell protect      = new EffectSpell(stats, new Protect(15f), 30f, "Protect");

        magicSkills.Add(palmOfBuddha);
        magicSkills.Add(nen);
        magicSkills.Add(rdef);
        magicSkills.Add(protect);

        special = new SpecialSkill(stats, 10f, new List <Spell> {
            new EffectSpell(stats, new OccultPower(), 0f, "")
        }, "OccultPower");
    }
Beispiel #3
0
    public Aragorn() : base("Aragorn")
    {
        Spell protect     = new EffectSpell(stats, new Protect(15f), 30f, "Protect");
        Spell focus       = new EffectSpell(stats, new PhysicalAttack(25f, 5), 10f, "Focused Rage");
        Spell inner       = new EffectSpell(stats, new Heal(30f, 1), 10f, "Inner Rage");
        Spell mortalCombo = new OffensiveSpell(stats, 30f, "Mortal Combo");

        magicSkills.Add(protect);
        magicSkills.Add(inner);
        magicSkills.Add(focus);
        magicSkills.Add(mortalCombo);

        special = new SpecialSkill(stats, 10f, new List <Spell> {
            new OffensiveSpell(stats, 65f, "")
        }, "Mortal");
    }
Beispiel #4
0
    public Kvothe() : base("Kvothe")
    {
        Spell fireball   = new OffensiveSpell(stats, 15f, "Fire ball");
        Spell songOfWind = new EffectSpell(stats, new Velocity(3f), 10f, "Song of wind");
        Spell waterball  = new OffensiveSpell(stats, 25f, "Water ball");
        Spell memory     = new EffectSpell(stats, new MagicalAttack(30f, 2), 10f, "Memory");

        magicSkills.Add(fireball);
        magicSkills.Add(waterball);
        magicSkills.Add(songOfWind);
        magicSkills.Add(memory);

        special = new SpecialSkill(stats, 10f, new List <Spell> {
            new EffectSpell(stats, new Velocity(4f), 0f, ""), new EffectSpell(stats, new Heal(3f, 4), 0f, "")
        }, "Denna song");
    }
Beispiel #5
0
        private void Calc(LivingEntity ent, bool withVariation, ref AttackKind attackKind, OffensiveSpell spell)
        {
            try
            {
                this.withVariation = withVariation;
                this.spell         = spell;
                NonPhysical        = new Dictionary <EntityStatKind, float>();
                this.ent           = ent;
                Weapon wpn = null;
                //if (ent != null)//can be if using WeaponElementalProjectile
                {
                    wpn = ent.GetActiveWeapon();

                    attackKind = DiscoverAttackKind(attackKind, wpn);
                    AttackKind = attackKind;
                }

                if (AttackKind == AttackKind.SpellElementalProjectile && spell == null)
                {
                    return;
                }

                if (attackKind == AttackKind.PhysicalProjectile)
                {
                    fightItem = GetActiveFightItem(ent);
                    if (fightItem == null)
                    {
                        return;
                    }
                }
                if (attackKind == AttackKind.WeaponElementalProjectile)
                {
                    if (wpn != null)
                    {
                        if (wpn.SpellSource == null || wpn.SpellSource.Count == 0)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk = null;
                EntityStatKind attackStat = EntityStatKind.Unset;
                if (attackKind == AttackKind.Melee)
                {
                    attackStat = EntityStatKind.MeleeAttack;

                    weapons2Esk = AdvancedLivingEntity.MalleeWeapons2Esk;
                    if (wpn != null && wpn.IsMagician)
                    {
                        weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                    }
                }
                else if (attackKind == AttackKind.PhysicalProjectile ||
                         attackKind == AttackKind.WeaponElementalProjectile)
                {
                    attackStat = EntityStatKind.Unset;
                    if (attackKind == AttackKind.PhysicalProjectile)
                    {
                        attackStat = EntityStatKind.PhysicalProjectilesAttack;
                    }
                    else
                    {
                        attackStat = EntityStatKind.ElementalWeaponProjectilesAttack;
                    }
                    weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                }
                CalcMembers(ent, wpn, weapons2Esk, attackStat, attackKind);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        private void CalcMembers
        (
            LivingEntity ent,
            Weapon wpn,
            Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk,
            EntityStatKind attackStat,
            AttackKind attackKind
        )
        {
            if (attackStat != EntityStatKind.Unset)
            {
                Current = ent.GetCurrentValue(attackStat);
            }
            else
            {
                Current = 0;
            }
            OffensiveSpell offensiveSpell = spell;

            if (wpn != null)
            {
                if (wpn.IsBowLike && attackKind == AttackKind.PhysicalProjectile)
                {
                    if (fightItem.IsBowLikeAmmo)
                    {
                        Current += fightItem.Damage;
                    }
                    else
                    {
                        Current -= wpn.Damage;//ammo not matching
                    }
                }
                else if (wpn.IsMagician && attackKind == AttackKind.WeaponElementalProjectile)
                {
                    offensiveSpell = wpn.SpellSource.CreateSpell(ent) as OffensiveSpell;
                }
            }

            if (attackKind == AttackKind.PhysicalProjectile && fightItem != null)
            {
                if (fightItem.FightItemKind == Tiles.Looting.FightItemKind.Stone ||
                    fightItem.FightItemKind == Tiles.Looting.FightItemKind.ThrowingKnife
                    )
                {
                    Current += fightItem.Damage;
                    Current += ent.Stats.Strength / 2;
                }
            }

            CurrentPhysical         = Current;
            CurrentPhysicalVariated = CurrentPhysical;
            if (withVariation)//GUI is not meant to have it changed on character panel
            {
                CurrentPhysicalVariated += CalcVariation(attackKind, true, CurrentPhysical);
            }

            if (CurrentPhysicalVariated < 0)
            {
                CurrentPhysicalVariated = 0;
            }
            if (CurrentPhysical < 0)
            {
                CurrentPhysical = 0;
            }

            var val = CurrentPhysicalVariated;

            //add melee damage
            AddExtraDamage(ent, wpn, weapons2Esk, ref val);
            CurrentPhysicalVariated += val - CurrentPhysicalVariated;

            CurrentTotal = CurrentPhysicalVariated;

            if (offensiveSpell != null &&
                (attackKind == AttackKind.SpellElementalProjectile || attackKind == AttackKind.WeaponElementalProjectile))
            {
                var dmg = offensiveSpell.GetDamage();
                if (withVariation)
                {
                    dmg += CalcVariation(attackKind, true, dmg);
                }
                if (wpn != null && attackKind == AttackKind.WeaponElementalProjectile)
                {
                    //add extra magic projectile damage
                    AddExtraDamage(ent, wpn, weapons2Esk, ref dmg);
                }

                NonPhysical[offensiveSpell.Kind.ToEntityStatKind()] = dmg;
                CurrentTotal += dmg;
            }

            if (attackKind != AttackKind.SpellElementalProjectile)
            {
                var nonPhysical = ent.GetNonPhysicalDamages();
                foreach (var npd in nonPhysical)
                {
                    bool add = true;
                    if (wpn != null)
                    {
                        if (attackKind == AttackKind.WeaponElementalProjectile)
                        {
                            if (wpn.IsMagician)
                            {
                                add = offensiveSpell.Kind.ToEntityStatKind() == npd.Key;
                            }
                        }
                        else if (attackKind == AttackKind.Melee)
                        {
                            add = !wpn.IsBowLike;
                        }

                        if (add)
                        {
                            var addition = npd.Value;
                            AddExtraDamage(ent, wpn, weapons2Esk, ref addition);
                            CurrentTotal += addition;


                            if (!NonPhysical.ContainsKey(npd.Key))
                            {
                                NonPhysical[npd.Key] = 0;
                            }
                            NonPhysical[npd.Key] += addition;
                        }
                    }
                }
            }

            Nominal = ent.Stats.GetStat(attackStat).Value.Nominal;
            Display = Nominal + "/" + CurrentTotal;
        }
Beispiel #7
0
        private void Calc(LivingEntity ent, bool withVariation, ref AttackKind attackKind, OffensiveSpell spell)
        {
            try
            {
                this.withVariation = withVariation;
                this.spell         = spell;
                NonPhysical        = new Dictionary <EntityStatKind, float>();
                this.ent           = ent;
                var wpn = ent.GetActiveWeapon();

                attackKind = DiscoverAttackKind(attackKind, wpn);

                if (attackKind == AttackKind.PhysicalProjectile)
                {
                    fightItem = ent.ActiveFightItem;
                    if (fightItem == null)
                    {
                        fightItem = ent.RecentlyActivatedFightItem;//HACK
                        if (fightItem == null)
                        {
                            return;
                        }
                    }
                }
                if (attackKind == AttackKind.WeaponElementalProjectile)
                {
                    //if (wpn != null && )
                    //{
                    //  if (wpn.SpellSource.Count == 0)
                    //    return;
                    //}
                }

                Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk = null;
                EntityStatKind attackStat = EntityStatKind.Unset;
                if (attackKind == AttackKind.Melee)
                {
                    attackStat = EntityStatKind.MeleeAttack;

                    weapons2Esk = AdvancedLivingEntity.MalleeWeapons2Esk;
                    if (wpn != null && wpn.IsMagician)
                    {
                        weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                    }
                }
                else if (attackKind == AttackKind.PhysicalProjectile ||
                         attackKind == AttackKind.WeaponElementalProjectile)
                {
                    attackStat = EntityStatKind.Unset;
                    if (attackKind == AttackKind.PhysicalProjectile)
                    {
                        attackStat = EntityStatKind.PhysicalProjectilesAttack;
                    }
                    else
                    {
                        attackStat = EntityStatKind.ElementalWeaponProjectilesAttack;
                    }
                    weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                }
                CalcMembers(ent, wpn, weapons2Esk, attackStat, attackKind);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            //finally
            //{
            //  if (CurrentTotal == 0 && attackKind != AttackKind.Melee)
            //  {
            //    AttackKind attackKindAlt = AttackKind.Melee;
            //    Calc(ent, withVariation, ref attackKindAlt, spell);
            //  }
            //}
        }