示例#1
0
        public static IModule CreateShieldModule(int ownerId, string id)
        {
            IModule resultModule = null;

            switch (id)
            {
            case "SSM5001":
                resultModule = new ShieldModule
                {
                    Id             = RandomGenerator.GetId(),
                    OwnerId        = ownerId,
                    ActivationCost = 100,
                    Power          = 200,
                    Category       = Category.Shield,
                    Name           = "Shield Mk I"
                };
                break;

            case "SSM5002":
                resultModule = new ShieldModule
                {
                    Id             = RandomGenerator.GetId(),
                    OwnerId        = ownerId,
                    ActivationCost = 110,
                    Power          = 250,
                    Category       = Category.Shield,
                    Name           = "Shield Mk II"
                };
                break;
            }

            return(resultModule);
        }
示例#2
0
 public static void ShieldTest()
 {
     var slot = new SizedSlot<CircularItemContainer, Hopper.Core.Items.IItem>("blocking", 1);
     var shield = new Hopper.Core.Items.ModularItem(new ItemMetadata("Test_Shield"), slot, ShieldModule.CreateFront(2));
     var enemy.Factory = new EntityFactory<Entity>().AddBehavior(Attackable.DefaultPreset);
     var player.Factory = new EntityFactory<Entity>()
         .AddBehavior(Attacking.Preset)
         .AddBehavior(Acting.Preset(new Acting.Config(Algos.SimpleAlgo)));
     var world = new World(5, 5);
     var player = world.SpawnPlayer(player.Factory, new IntVector2(1, 1));
     player.Reorient(new IntVector2(1, 0));
     var enemy = world.SpawnEntity(enemy.Factory, new IntVector2(2, 1));
     enemy.Reorient(new IntVector2(-1, 0));
     shield.BeEquipped(enemy);
     var attackAction = Action.CreateBehavioral<Attacking>();
     player.Behaviors.Get<Acting>().NextAction = attackAction.WithDir(new IntVector2(1, 0));
     world.Loop();
     player.Stats.GetRaw(Attack.Path).pierce += 2;
     player.Behaviors.Get<Acting>().NextAction = attackAction.WithDir(new IntVector2(1, 0));
     world.Loop();
 }