Example #1
0
        /// <summary>
        /// Indique si oui ou non ce sort a un effet sur l'entité donné.
        /// </summary>
        public bool HasEffectOn(EntityBase entity, SpellCastTargetInfo info)
        {
            // Vérifie que le sort peut toucher cette entité.
            EntityTypeRelative flag = EntityTypeConverter.ToRelative(entity.Type, SourceCaster.Type & (EntityType.Team1 | EntityType.Team2));

            if (!(Description.TargetType.AllowedTargetTypes.HasFlag(flag) ||
                  (Description.TargetType.AllowedTargetTypes.HasFlag(EntityTypeRelative.Me) && entity.ID == SourceCaster.ID)))
            {
                return(false);
            }

            // Vérifie que si le sort est targetté, il on est bien sur la bonne cible.
            if (Description.TargetType.Type == Spells.TargettingType.Targetted &&
                entity.ID != info.TargetId)
            {
                return(false);
            }

            // Si le caster et le receveur, on vérifie que le flag "me" est présent.
            if ((!Description.TargetType.AllowedTargetTypes.HasFlag(EntityTypeRelative.Me)) && entity.ID == SourceCaster.ID)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public static SpellTargetInfoView Deserialize(System.IO.StreamReader input)
        {
            SpellTargetInfoView _obj = new SpellTargetInfoView();
            // Type
            TargettingType _obj_Type = (TargettingType)Int32.Parse(input.ReadLine());

            _obj.Type = (TargettingType)_obj_Type;
            // Range
            float _obj_Range = Single.Parse(input.ReadLine());

            _obj.Range = (float)_obj_Range;
            // Duration
            float _obj_Duration = Single.Parse(input.ReadLine());

            _obj.Duration = (float)_obj_Duration;
            // AoeRadius
            float _obj_AoeRadius = Single.Parse(input.ReadLine());

            _obj.AoeRadius = (float)_obj_AoeRadius;
            // DieOnCollision
            bool _obj_DieOnCollision = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.DieOnCollision = (bool)_obj_DieOnCollision;
            // AllowedTargetTypes
            EntityTypeRelative _obj_AllowedTargetTypes = (EntityTypeRelative)Int32.Parse(input.ReadLine());

            _obj.AllowedTargetTypes = (EntityTypeRelative)_obj_AllowedTargetTypes;
            return(_obj);
        }
Example #3
0
        /// <summary>
        /// Crée une nouvelle instance de FireballSpell.
        /// </summary>
        /// <param name="caster"></param>
        public FireballSpell(EntityBase caster,
                             float cooldownBase = 1.7f,
                             float attackRange  = 6.0f,
                             EntityTypeRelative allowedTargets = EntityTypeRelative.AllEnnemy | EntityTypeRelative.AllTargettableNeutral)
        {
            SourceCaster = caster;
            Model        = new SpellModel(
                new List <SpellLevelDescription>()
            {
                new SpellLevelDescription()
                {
                    TargetType = new SpellTargetInfo()
                    {
                        AllowedTargetTypes = allowedTargets,
                        AoeRadius          = 0.3f,
                        Range          = attackRange,
                        Duration       = 0.6f,
                        DieOnCollision = true,
                        Type           = TargettingType.Targetted
                    },
                    BaseCooldown           = cooldownBase,
                    CastingTime            = 0.01f,
                    CastingTimeAlterations = new List <StateAlterationModel>()
                    {
                        new StateAlterationModel()
                        {
                            Type         = StateAlterationType.Root,
                            BaseDuration = 0.01f,
                        }
                    },

                    OnHitEffects = new List <StateAlterationModel>()
                    {
                        new StateAlterationModel()
                        {
                            Type                 = StateAlterationType.AttackDamage,
                            BaseDuration         = 0.0f,
                            SourcePercentADValue = 1.0f,
                        },
                    }
                }
            }, "Fireball");
            CurrentCooldown = 0.0f;
        }
Example #4
0
        public static EntityType ToAbsolute(EntityTypeRelative relative, EntityType team)
        {
            team = team & (EntityType.Team1 | EntityType.Team2);
            if (team != EntityType.Team1 && team != EntityType.Team2)
            {
                throw new InvalidOperationException();
            }

            int absInt = (int)relative;

            // Team opposée.
            EntityType other;

            if ((team & EntityType.Team1) == EntityType.Team1)
            {
                other = EntityType.Team2;
            }
            else
            {
                other = EntityType.Team1;
            }

            if ((relative & EntityTypeRelative.Ally) == EntityTypeRelative.Ally)
            {
                // Team alliée = team1
                absInt ^= (int)EntityTypeRelative.Ally;
                absInt |= (int)team;
            }
            else if ((relative & EntityTypeRelative.Ennemy) == EntityTypeRelative.Ennemy)
            {
                // Team ennemie : on remplace ennemy par other.
                absInt ^= (int)EntityTypeRelative.Ennemy;
                absInt |= (int)other;
            }
            else
            {
                // neutre : ne rien changer.
            }

            return((EntityType)absInt);
        }
Example #5
0
        public static EntityBaseView Deserialize(System.IO.StreamReader input)
        {
            EntityBaseView _obj = new EntityBaseView();
            // GetMagicResist
            float _obj_GetMagicResist = Single.Parse(input.ReadLine());

            _obj.GetMagicResist = (float)_obj_GetMagicResist;
            // GetAbilityPower
            float _obj_GetAbilityPower = Single.Parse(input.ReadLine());

            _obj.GetAbilityPower = (float)_obj_GetAbilityPower;
            // GetCooldownReduction
            float _obj_GetCooldownReduction = Single.Parse(input.ReadLine());

            _obj.GetCooldownReduction = (float)_obj_GetCooldownReduction;
            // GetMoveSpeed
            float _obj_GetMoveSpeed = Single.Parse(input.ReadLine());

            _obj.GetMoveSpeed = (float)_obj_GetMoveSpeed;
            // GetAttackSpeed
            float _obj_GetAttackSpeed = Single.Parse(input.ReadLine());

            _obj.GetAttackSpeed = (float)_obj_GetAttackSpeed;
            // GetHPRegen
            float _obj_GetHPRegen = Single.Parse(input.ReadLine());

            _obj.GetHPRegen = (float)_obj_GetHPRegen;
            // GetAttackDamage
            float _obj_GetAttackDamage = Single.Parse(input.ReadLine());

            _obj.GetAttackDamage = (float)_obj_GetAttackDamage;
            // GetArmor
            float _obj_GetArmor = Single.Parse(input.ReadLine());

            _obj.GetArmor = (float)_obj_GetArmor;
            // GetHP
            float _obj_GetHP = Single.Parse(input.ReadLine());

            _obj.GetHP = (float)_obj_GetHP;
            // GetMaxHP
            float _obj_GetMaxHP = Single.Parse(input.ReadLine());

            _obj.GetMaxHP = (float)_obj_GetMaxHP;
            // UniquePassiveLevel
            int _obj_UniquePassiveLevel = Int32.Parse(input.ReadLine());

            _obj.UniquePassiveLevel = (int)_obj_UniquePassiveLevel;
            // UniquePassive
            EntityUniquePassives _obj_UniquePassive = (EntityUniquePassives)Int32.Parse(input.ReadLine());

            _obj.UniquePassive = (EntityUniquePassives)_obj_UniquePassive;
            // Role
            EntityHeroRole _obj_Role = (EntityHeroRole)Int32.Parse(input.ReadLine());

            _obj.Role = (EntityHeroRole)_obj_Role;
            // BaseArmor
            float _obj_BaseArmor = Single.Parse(input.ReadLine());

            _obj.BaseArmor = (float)_obj_BaseArmor;
            // Direction
            Vector2 _obj_Direction = Vector2.Deserialize(input);

            _obj.Direction = (Vector2)_obj_Direction;
            // Position
            Vector2 _obj_Position = Vector2.Deserialize(input);

            _obj.Position = (Vector2)_obj_Position;
            // ShieldPoints
            float _obj_ShieldPoints = Single.Parse(input.ReadLine());

            _obj.ShieldPoints = (float)_obj_ShieldPoints;
            // HP
            float _obj_HP = Single.Parse(input.ReadLine());

            _obj.HP = (float)_obj_HP;
            // BaseHPRegen
            float _obj_BaseHPRegen = Single.Parse(input.ReadLine());

            _obj.BaseHPRegen = (float)_obj_BaseHPRegen;
            // BaseMaxHP
            float _obj_BaseMaxHP = Single.Parse(input.ReadLine());

            _obj.BaseMaxHP = (float)_obj_BaseMaxHP;
            // BaseMoveSpeed
            float _obj_BaseMoveSpeed = Single.Parse(input.ReadLine());

            _obj.BaseMoveSpeed = (float)_obj_BaseMoveSpeed;
            // IsDead
            bool _obj_IsDead = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsDead = (bool)_obj_IsDead;
            // Type
            EntityTypeRelative _obj_Type = (EntityTypeRelative)Int32.Parse(input.ReadLine());

            _obj.Type = (EntityTypeRelative)_obj_Type;
            // ID
            int _obj_ID = Int32.Parse(input.ReadLine());

            _obj.ID = (int)_obj_ID;
            // BaseAttackDamage
            float _obj_BaseAttackDamage = Single.Parse(input.ReadLine());

            _obj.BaseAttackDamage = (float)_obj_BaseAttackDamage;
            // BaseCooldownReduction
            float _obj_BaseCooldownReduction = Single.Parse(input.ReadLine());

            _obj.BaseCooldownReduction = (float)_obj_BaseCooldownReduction;
            // BaseAttackSpeed
            float _obj_BaseAttackSpeed = Single.Parse(input.ReadLine());

            _obj.BaseAttackSpeed = (float)_obj_BaseAttackSpeed;
            // BaseAbilityPower
            float _obj_BaseAbilityPower = Single.Parse(input.ReadLine());

            _obj.BaseAbilityPower = (float)_obj_BaseAbilityPower;
            // BaseMagicResist
            float _obj_BaseMagicResist = Single.Parse(input.ReadLine());

            _obj.BaseMagicResist = (float)_obj_BaseMagicResist;
            // IsRooted
            bool _obj_IsRooted = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsRooted = (bool)_obj_IsRooted;
            // IsSilenced
            bool _obj_IsSilenced = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsSilenced = (bool)_obj_IsSilenced;
            // IsStuned
            bool _obj_IsStuned = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsStuned = (bool)_obj_IsStuned;
            // IsDamageImmune
            bool _obj_IsDamageImmune = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsDamageImmune = (bool)_obj_IsDamageImmune;
            // IsControlImmune
            bool _obj_IsControlImmune = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsControlImmune = (bool)_obj_IsControlImmune;
            // IsBlind
            bool _obj_IsBlind = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsBlind = (bool)_obj_IsBlind;
            // IsStealthed
            bool _obj_IsStealthed = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.IsStealthed = (bool)_obj_IsStealthed;
            // HasTrueVision
            bool _obj_HasTrueVision = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.HasTrueVision = (bool)_obj_HasTrueVision;
            // HasWardVision
            bool _obj_HasWardVision = Int32.Parse(input.ReadLine()) == 0 ? false : true;

            _obj.HasWardVision = (bool)_obj_HasWardVision;
            // VisionRange
            float _obj_VisionRange = Single.Parse(input.ReadLine());

            _obj.VisionRange = (float)_obj_VisionRange;
            return(_obj);
        }