Ejemplo n.º 1
0
        // Generic dot spell -- TODO: Incorporate the type of damage
        public static int createDoTSpell(int targetEntityId, DamageType damageType, string damageDie, int tickDelay, int tickCount)
        {
            int entityId = EntityManager.createEntity();
            FactionComponent factionComponent = EntityManager.getFactionComponent(targetEntityId);
            DamageOverTimeComponent damageOverTimeComponent = new DamageOverTimeComponent(entityId, damageType, damageDie, tickDelay);
            TimeToLiveComponent timeToLiveComponent = new TimeToLiveComponent(entityId, tickCount * tickDelay);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId);
            AffectedBySpellEntitiesComponent affectedBySpellEntitiesComponent = EntityManager.getAffectedBySpellEntitiesComponent(targetEntityId);
            DispellableComponent dispellableComponent = new DispellableComponent(entityId, new List<Faction>(new [] { factionComponent.faction }));

            affectedEntitiesComponent.entities.Add(targetEntityId);
            affectedBySpellEntitiesComponent.spellEntities.Add(entityId);

            EntityManager.addComponent(entityId, damageOverTimeComponent);
            EntityManager.addComponent(entityId, timeToLiveComponent);
            EntityManager.addComponent(entityId, affectedEntitiesComponent);
            EntityManager.addComponent(entityId, dispellableComponent);

            return entityId;
        }
Ejemplo n.º 2
0
        // Create rain of fire spell
        public static int createRainOfFireSpell(int ownerId, Vector2 position, float width, string damageDie, int tickDelay, int tickCount, List<Faction> factionsToAffect)
        {
            int entityId = EntityManager.createEntity();
            DamageOverTimeComponent damageOverTimeComponent = new DamageOverTimeComponent(entityId, DamageType.Fire, damageDie, tickDelay);
            TimeToLiveComponent timeToLiveComponent = new TimeToLiveComponent(entityId, tickDelay * tickCount);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId, factionsToAffect);
            Body sensor = BodyFactory.CreateRectangle(SystemManager.physicsSystem.world, width, 100f, 1f, position);
            AreaOfEffectComponent areaOfEffectComponent = new AreaOfEffectComponent(entityId, sensor);

            sensor.UserData = entityId;
            sensor.BodyType = BodyType.Static;
            sensor.CollidesWith = (ushort)CollisionCategory.None;

            EntityManager.addComponent(entityId, damageOverTimeComponent);
            EntityManager.addComponent(entityId, timeToLiveComponent);
            EntityManager.addComponent(entityId, affectedEntitiesComponent);
            EntityManager.addComponent(entityId, areaOfEffectComponent);
            EntityManager.addComponent(entityId, new SpellTypeComponent(entityId, SpellType.RainOfFire));
            EntityManager.addComponent(entityId, new SpellOwnerComponent(entityId, ownerId));
            EntityManager.addComponent(entityId, new IgnoreBridgeRaycastComponent(entityId));
            EntityManager.addComponent(entityId, new IgnoreRopeRaycastComponent(entityId));

            return entityId;
        }
Ejemplo n.º 3
0
        // Spiked shield spell entity
        public static int createSpikedShieldSpell(int targetEntityId, string damageDie, float radius, List<Faction> factionsToAffect)
        {
            int entityId = EntityManager.createEntity();
            TrackEntityPositionComponent trackEntityPositionComponent = new TrackEntityPositionComponent(entityId, targetEntityId);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId, factionsToAffect);
            DamageOverTimeComponent damageOverTimeComponent = new DamageOverTimeComponent(entityId, DamageType.Physical, damageDie, 60);
            AreaOfEffectComponent areaOfEffectComponent;
            Body sensor = BodyFactory.CreateCircle(SystemManager.physicsSystem.world, radius, 1f);

            sensor.UserData = entityId;
            sensor.CollidesWith = (ushort)CollisionCategory.None;
            sensor.BodyType = BodyType.Static;
            areaOfEffectComponent = new AreaOfEffectComponent(entityId, sensor);

            EntityManager.addComponent(entityId, trackEntityPositionComponent);
            EntityManager.addComponent(entityId, affectedEntitiesComponent);
            EntityManager.addComponent(entityId, damageOverTimeComponent);
            EntityManager.addComponent(entityId, areaOfEffectComponent);
            EntityManager.addComponent(entityId, new IgnoreBridgeRaycastComponent(entityId));
            EntityManager.addComponent(entityId, new IgnoreRopeRaycastComponent(entityId));

            return entityId;
        }