예제 #1
0
        public override GameEvent_Command ReifyStub(FloorState floor)
        {
            var commandEntity          = floor.ResolveEID(this.CommandEID);
            var commandPosition        = commandEntity.TryGetPosition();
            var entityAtTargetPosition = floor.EntityAtPosition(commandPosition.X + (int)this.X,
                                                                commandPosition.Y + (int)this.Y);

            if (entityAtTargetPosition != null)
            {
                // TODO: Don't always bump attack to torso
                return(new CommandStub_PrepareTargetedAttack(this.CommandEID, entityAtTargetPosition.EntityID,
                                                             entityAtTargetPosition.Label, BodyPartLocation.TORSO)
                       .ReifyStub(floor));
            }
            else
            {
                return(new GameEvent_MoveSingle(floor.CurrentTick, Config.ONE, commandEntity, this.X, this.Y, floor));
            }
        }
예제 #2
0
        public override GameEvent_Command ReifyStub(FloorState floor)
        {
            var attackerEntity = floor.ResolveEID(this.AttackerEID);
            var equippedWeapon = attackerEntity.GetComponentOfType <Component_Skeleton>()
                                 .InspectBodyPart(BodyPartLocation.RIGHT_ARM)
                                 .TryGetSubEntities(SubEntitiesSelector.WEAPON)
                                 .FirstOrDefault();

            // TODO: Don't require exact square
            var attackerPosition = attackerEntity.TryGetPosition();
            var targetEntity     = floor.EntityAtPosition(attackerPosition.X + this.x, attackerPosition.Y + this.y);

            if (targetEntity != null)
            {
                return(new GameEvent_PrepareAttack(floor.CurrentTick, Config.ONE, attackerEntity, targetEntity,
                                                   equippedWeapon, floor.FloorMap, this.SubTarget));
            }
            else
            {
                return(new GameEvent_Delay(floor.CurrentTick, Config.ONE, attackerEntity));
            }
        }