Example #1
0
 public void RemoveImmunity(eDamageTypes damagetype)
 {
     if (Immunities.Contains(damagetype))
     {
         Immunities.Remove(damagetype);
     }
 }
Example #2
0
 public void AddImmunitiy(eDamageTypes damagetype)
 {
     if (!Immunities.Contains(damagetype))
     {
         Immunities.Add(damagetype);
     }
 }
Example #3
0
 public void SetResistance(eDamageTypes damagetype, double val)
 {
     if (!Resistances.ContainsKey(damagetype))
     {
         Resistances.Add(damagetype, new StatDouble(0, 100.0, val, false));
     }
     else
     {
         Resistances[damagetype].SetCurrent(val);
     }
 }
Example #4
0
        public int TakeDamage(int damage, eDamageTypes damagetype, MobState source = null)
        {
            // returns the actual amount of damage taken
            damage = HandleResistances(damage, damagetype, source);
            Health.AddCurrent(-1 * damage);
            int newhp = Health.GetCurrent();

            if (newhp <= 0)
            {
                Die(source);
            }
            return(damage);
        }
Example #5
0
        }                                                  // if true, is ignored by summons in combat

        // (87) A1Move	A2Move	S1Move	S2Move	S3Move	S4Move	Cmove
        // (109) Skill1	Skill1Seq	Skill1Lvl	Skill2	Skill2Seq	Skill2Lvl	Skill3	Skill3Seq	Skill3Lvl	Skill4	Skill4Seq	Skill4Lvl	Skill5	Skill5Seq	Skill5Lvl
        // (146) eLUndead	eHUndead	eDemon	eMagicUsing	eLarge	eSmall	eFlying	eOpenDoors	eSpawnCol	eBoss


        public EnemyTypeCombatConfig(int ElementalAttackMode, eDamageTypes ElementalAttackType, int ElementalOverlayId,
                                     int ElementalChance, int ElementalMinDamage, int ElementalMaxDamage, int ElementalDuration,
                                     int[] MissileForAttack, int[] MissileForSkill, int MissileForCase, int MissileForSequence,
                                     bool[] CanMoveAttack, bool[] CanMoveSkill, bool CanMoveCast,
                                     bool IsMelee, bool IsAttackable,
                                     int MeleeRange,
                                     int[] SkillType, int[] SkillSequence, int[] SkillLevel,
                                     bool IsUndeadWithPhysicalAttacks, bool IsUndeadWithMagicAttacks, bool UsesMagicAttacks,
                                     int ChanceToBlock,
                                     bool DoesDeathDamage,
                                     bool IgnoredBySummons
                                     )
        {
            this.ElementalAttackMode = ElementalAttackMode;
            this.ElementalAttackType = ElementalAttackType;
            this.ElementalOverlayId  = ElementalOverlayId;
            this.ElementalChance     = ElementalChance;
            this.ElementalMinDamage  = ElementalMinDamage;
            this.ElementalMaxDamage  = ElementalMaxDamage;
            this.ElementalDuration   = ElementalDuration;

            this.MissileForAttack   = MissileForAttack;
            this.MissileForSkill    = MissileForSkill;
            this.MissileForCase     = MissileForCase;
            this.MissileForSequence = MissileForSequence;

            this.CanMoveAttack = CanMoveAttack;
            this.CanMoveSkill  = CanMoveSkill;
            this.CanMoveCast   = CanMoveCast;

            this.IsMelee      = IsMelee;
            this.IsAttackable = IsAttackable;

            this.MeleeRange = MeleeRange;

            this.SkillType     = SkillType;
            this.SkillSequence = SkillSequence;
            this.SkillLevel    = SkillLevel;

            this.IsUndeadWithPhysicalAttacks = IsUndeadWithPhysicalAttacks;
            this.IsUndeadWithMagicAttacks    = IsUndeadWithMagicAttacks;
            this.UsesMagicAttacks            = UsesMagicAttacks;

            this.ChanceToBlock = ChanceToBlock;

            this.DoesDeathDamage = DoesDeathDamage;

            this.IgnoredBySummons = IgnoredBySummons;
        }
Example #6
0
        protected int HandleResistances(int damage, eDamageTypes damagetype, MobState source = null)
        {
            if (damagetype == eDamageTypes.NONE)
            {
                return(damage);
            }
            if (Immunities.Contains(damagetype))
            {
                return(0);
            }
            if (!Resistances.ContainsKey(damagetype))
            {
                return(damage);
            }

            // TODO: need to verify 1) is damage integer? and 2) if so, how is this rounding down?
            // e.g. is it always 'round down' / 'round up' or does it use 'math.round'
            damage = (int)(damage * Resistances[damagetype].GetCurrent());
            return(damage);
        }
        }                                                          // client version of hitsubmissiles 1-4


        public MissileTypeConfig(string Name, int Id,
                                 int ClientMovementFunctionId, int ClientHitFunctionId, int ServerMovementFunctionId,
                                 int ServerHitFunctionId, int ServerDamageFunctionId,
                                 string ServerMovementCalc, int[] ServerMovementParams,
                                 string ClientMovementCalc, int[] ClientMovementParams,
                                 string ServerHitCalc, int[] ServerHitParams,
                                 string ClientHitCalc, int[] ClientHitParams,
                                 string ServerDamageCalc, int[] ServerDamageParams,
                                 int BaseVelocity, int MaxVelocity, int VelocityPerSkillLevel, int Acceleration, int Range, int ExtraRangePerLevel,
                                 int LightRadius, bool LightFlicker, byte[] LightColor,
                                 int FramesBeforeVisible, int FramesBeforeActive, bool LoopAnimation, string CelFilePath,
                                 int AnimationRate, int AnimationLength, int AnimationSpeed, int StartingFrame,
                                 bool AnimationHasSubLoop, int AnimationSubLoopStart, int AnimationSubLoopEnd,
                                 int CollisionType, bool CollideKill, bool CollideFriend, bool CollideLast,
                                 bool CollisionUnknown, bool CollisionClient, bool CollisionClientSend,
                                 bool CollisionUseTimer, int CollisionTimerLength,
                                 int XOffset, int YOffset, int ZOffset, int Size,
                                 bool SrcTown, bool SrcTownClient, bool CanDestroy,
                                 bool UseAttackRating, bool AlwaysExplode, bool IsClientExplosion,
                                 bool AllowedInTown, bool NoUniqueMod, bool NoMultishotMod, int Holy,
                                 bool CanSlow, bool ReturnFire, bool KnockIntoGetHit, bool SoftHit,
                                 int KnockbackChance, int TransparencyType, bool UsesQuantity, bool Pierce, bool SpecialSetup,
                                 bool MissileSkill, string SkillName, int ResultFlags, int HitFlags, int HitShift,
                                 bool ApplyMastery, int SourceDamage, bool HalfWithTwoHandedWeapon, int SourceMissileDamage,
                                 int MinDamage, int MaxDamage, int[] MinDamagePerLevel, int[] MaxDamagePerLevel,
                                 string PhysicalDamageSynergyCalc, eDamageTypes ElementalDamageType, int ElementalMinDamage,
                                 int ElementalMaxDamage, int[] ElementalMinDamagePerLevel, int[] ElementalMaxDamagePerLevel,
                                 string ElementalDamageSynergyCalc, int ElementalDuration, int[] ElementalDurationPerLevel,
                                 int HitClass, bool CanBleed, bool AffectedByOpenWounds, int DamageRate,
                                 string SoundTravel, string SoundHit, string SoundProg,
                                 string ProgOverlay, string ExplosionMissile,
                                 string[] SubMissiles, string[] HitSubMissiles,
                                 string[] ClientSubMissiles, string[] ClientHitSubMissiles
                                 )
        {
            this.Name = Name;
            this.Id   = Id;

            this.ClientMovementFunctionId = ClientMovementFunctionId;
            this.ClientHitFunctionId      = ClientHitFunctionId;
            this.ServerMovementFunctionId = ServerMovementFunctionId;
            this.ServerHitFunctionId      = ServerHitFunctionId;
            this.ServerDamageFunctionId   = ServerDamageFunctionId;
            this.ServerMovementCalc       = ServerMovementCalc;
            this.ServerMovementParams     = ServerMovementParams;
            this.ClientMovementCalc       = ClientMovementCalc;
            this.ClientMovementParams     = ClientMovementParams;
            this.ServerHitCalc            = ServerHitCalc;
            this.ServerHitParams          = ServerHitParams;
            this.ClientHitCalc            = ClientHitCalc;
            this.ClientHitParams          = ClientHitParams;
            this.ServerDamageCalc         = ServerDamageCalc;
            this.ServerDamageParams       = ServerDamageParams;

            this.BaseVelocity          = BaseVelocity;
            this.MaxVelocity           = MaxVelocity;
            this.VelocityPerSkillLevel = VelocityPerSkillLevel;
            this.Acceleration          = Acceleration;
            this.Range = Range;
            this.ExtraRangePerLevel = ExtraRangePerLevel;

            this.LightRadius  = LightRadius;
            this.LightFlicker = LightFlicker;
            this.LightColor   = LightColor;

            this.FramesBeforeVisible   = FramesBeforeVisible;
            this.FramesBeforeActive    = FramesBeforeActive;
            this.LoopAnimation         = LoopAnimation;
            this.CelFilePath           = CelFilePath;
            this.AnimationRate         = AnimationRate;
            this.AnimationLength       = AnimationLength;
            this.AnimationSpeed        = AnimationSpeed;
            this.StartingFrame         = StartingFrame;
            this.AnimationHasSubLoop   = AnimationHasSubLoop;
            this.AnimationSubLoopStart = AnimationSubLoopStart;
            this.AnimationSubLoopEnd   = AnimationSubLoopEnd;

            this.CollisionType        = CollisionType;
            this.CollideKill          = CollideKill;
            this.CollideFriend        = CollideFriend;
            this.CollideLast          = CollideLast;
            this.CollisionUnknown     = CollisionUnknown;
            this.CollisionClient      = CollisionClient;
            this.CollisionClientSend  = CollisionClientSend;
            this.CollisionUseTimer    = CollisionUseTimer;
            this.CollisionTimerLength = CollisionTimerLength;

            this.XOffset           = XOffset;
            this.YOffset           = YOffset;
            this.ZOffset           = ZOffset;
            this.Size              = Size;
            this.SrcTown           = SrcTown;
            this.SrcTownClient     = SrcTownClient;
            this.CanDestroy        = CanDestroy;
            this.UseAttackRating   = UseAttackRating;
            this.AlwaysExplode     = AlwaysExplode;
            this.IsClientExplosion = IsClientExplosion;
            this.AllowedInTown     = AllowedInTown;
            this.NoUniqueMod       = NoUniqueMod;
            this.NoMultishotMod    = NoMultishotMod;
            this.Holy              = Holy;
            this.CanSlow           = CanSlow;
            this.ReturnFire        = ReturnFire;
            this.KnockIntoGetHit   = KnockIntoGetHit;
            this.SoftHit           = SoftHit;
            this.KnockbackChance   = KnockbackChance;
            this.TransparencyType  = TransparencyType;
            this.UsesQuantity      = UsesQuantity;
            this.Pierce            = Pierce;
            this.SpecialSetup      = SpecialSetup;

            this.MissileSkill               = MissileSkill;
            this.SkillName                  = SkillName;
            this.ResultFlags                = ResultFlags;
            this.HitFlags                   = HitFlags;
            this.HitShift                   = HitShift;
            this.ApplyMastery               = ApplyMastery;
            this.SourceDamage               = SourceDamage;
            this.HalfWithTwoHandedWeapon    = HalfWithTwoHandedWeapon;
            this.SourceMissileDamage        = SourceMissileDamage;
            this.MinDamage                  = MinDamage;
            this.MaxDamage                  = MaxDamage;
            this.MinDamagePerLevel          = MinDamagePerLevel;
            this.MaxDamagePerLevel          = MaxDamagePerLevel;
            this.PhysicalDamageSynergyCalc  = PhysicalDamageSynergyCalc;
            this.ElementalDamageType        = ElementalDamageType;
            this.ElementalMinDamage         = ElementalMinDamage;
            this.ElementalMaxDamage         = ElementalMaxDamage;
            this.ElementalMinDamagePerLevel = ElementalMinDamagePerLevel;
            this.ElementalMaxDamagePerLevel = ElementalMaxDamagePerLevel;
            this.ElementalDamageSynergyCalc = ElementalDamageSynergyCalc;
            this.ElementalDuration          = ElementalDuration;
            this.ElementalDurationPerLevel  = ElementalDurationPerLevel;

            this.HitClass             = HitClass;
            this.CanBleed             = CanBleed;
            this.AffectedByOpenWounds = AffectedByOpenWounds;
            this.DamageRate           = DamageRate;
            this.SoundTravel          = SoundTravel;
            this.SoundHit             = SoundHit;
            this.SoundProg            = SoundProg;
            this.ProgOverlay          = ProgOverlay;
            this.ExplosionMissile     = ExplosionMissile;
            this.SubMissiles          = SubMissiles;
            this.HitSubMissiles       = HitSubMissiles;
            this.ClientSubMissiles    = ClientSubMissiles;
            this.ClientHitSubMissiles = ClientHitSubMissiles;
        }