コード例 #1
0
        public TraitAction Transform(TraitContext context)
        {
            this.Tap(context);

            var carnivorous = (CarnivorousAction)context.TraitAction;

            return(new CarnivorousAction(carnivorous.Trait, Animal.Player.Brain.SelectAnimal(this.GetTargetAnimals(carnivorous), false)));
        }
コード例 #2
0
        public bool CanTransform(TraitContext context)
        {
            var carnivorous = context.TraitAction as CarnivorousAction;

            if (carnivorous != null)
            {
                return(!IsTapped && carnivorous.TargetAnimal == Animal && Animal.Count > 1);
            }

            return(false);
        }
コード例 #3
0
        public TraitAction Transform(TraitContext context)
        {
            this.Tap(context);

            if (context.Game.Random.Next(1, 7) > 3)
            {
                return(new RunningAction(this, ((CarnivorousAction)context.TraitAction).Trait));
            }

            return(context.TraitAction);
        }
コード例 #4
0
        public bool CanAttach(TraitContext context)
        {
            var carnivorous = context.TraitAction as CarnivorousAction;

            if (carnivorous != null)
            {
                return(carnivorous.TargetAnimal.Player == Animal.Player &&
                       Animal.Food.HasRoomForMore &&
                       context.TraitAction[typeof(Poisonous)] == null);
            }

            return(false);
        }
コード例 #5
0
 public void Attach(TraitContext context)
 {
     context.TraitAction[typeof(Poisonous)] = new object();
     Animal.Food.TakeFrom(context.Game.ExtraFood);
 }
コード例 #6
0
        public TraitAction Transform(TraitContext context)
        {
            var tailTrait = Animal.Player.Brain.SelectTrait(Animal.Traits.Skip(1), false);

            return(new TailLossAction(this, tailTrait, (Carnivorous)context.TraitAction.Trait));
        }