Exemplo n.º 1
0
        // Create infusion spell
        public static int createInfusionSpell(int targetEntityId, int maxHpMod, int strengthMod, int armorClassMod, int timeToLive)
        {
            int entityId = EntityManager.createEntity();
            TimeToLiveComponent timeToLiveComponent = new TimeToLiveComponent(entityId, timeToLive);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId);
            AffectedBySpellEntitiesComponent affectedBySpellEntitiesComponent = EntityManager.getAffectedBySpellEntitiesComponent(targetEntityId);
            StatModifierComponent statModifierComponent = new StatModifierComponent(entityId);

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

            statModifierComponent.maxHpMod = maxHpMod;
            statModifierComponent.strengthMod = strengthMod;
            statModifierComponent.armorClassMod = armorClassMod;

            EntityManager.addComponent(entityId, timeToLiveComponent);
            EntityManager.addComponent(entityId, affectedEntitiesComponent);
            EntityManager.addComponent(entityId, statModifierComponent);

            return entityId;
        }
Exemplo n.º 2
0
        // Deadeye spell entity
        public static int createDeadeyeSpell(int targetEntityId, int attackDieMod, float radius, List<Faction> factionsToAffect)
        {
            int entityId = EntityManager.createEntity();
            TrackEntityPositionComponent trackEntityPositionComponent = new TrackEntityPositionComponent(entityId, targetEntityId);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId, factionsToAffect);
            StatModifierComponent statModifierComponent = new StatModifierComponent(entityId);
            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);

            statModifierComponent.attackDieMod = attackDieMod;

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

            return entityId;
        }
Exemplo n.º 3
0
        // Create frenzy spell
        public static int createFrenzySpell(int ownerId, int damageBonus, int attackDelayBonus, int timeToLive)
        {
            int entityId = EntityManager.createEntity();
            AffectedBySpellEntitiesComponent affectedBySpellEntitiesComponent = EntityManager.getAffectedBySpellEntitiesComponent(ownerId);
            AffectedEntitiesComponent affectedEntitiesComponent = new AffectedEntitiesComponent(entityId);
            StatModifierComponent statModifierComponent = new StatModifierComponent(entityId);

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

            statModifierComponent.attackDelayMod = -attackDelayBonus;
            statModifierComponent.damageDieMod = damageBonus;

            EntityManager.addComponent(entityId, affectedEntitiesComponent);
            EntityManager.addComponent(entityId, statModifierComponent);
            EntityManager.addComponent(entityId, new TimeToLiveComponent(entityId, timeToLive));

            return entityId;
        }
Exemplo n.º 4
0
        // Create battle cry spell
        public static int createBattleCrySpell(int ownerId, float radius, int attackDelayBonus, int damageBonus, List<Faction> factionsToAffect)
        {
            int entityId = EntityManager.createEntity();
            Body sensor = BodyFactory.CreateCircle(SystemManager.physicsSystem.world, radius, 1f);
            StatModifierComponent statModifierComponent = new StatModifierComponent(entityId);

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

            statModifierComponent.attackDelayMod = -attackDelayBonus;
            statModifierComponent.damageDieMod = damageBonus;

            EntityManager.addComponent(entityId, new TrackEntityPositionComponent(entityId, ownerId));
            EntityManager.addComponent(entityId, new AreaOfEffectComponent(entityId, sensor));
            EntityManager.addComponent(entityId, new AffectedEntitiesComponent(entityId, factionsToAffect));
            EntityManager.addComponent(entityId, statModifierComponent);
            EntityManager.addComponent(entityId, new IgnoreBridgeRaycastComponent(entityId));
            EntityManager.addComponent(entityId, new IgnoreRopeRaycastComponent(entityId));

            return entityId;
        }