Esempio n. 1
0
        private Tuple <State, BoardUndo> MoveOneStep(Point dir, BoardUndo undo = null)
        {
            var newPosition = Position + dir;

            var item = Board.Get(newPosition);

            if (item == Board.Wall &&
                (DrillTime == 0 || !Board.IsInBounds(newPosition)))
            {
                return(null);
            }

            Position = newPosition;

            undo = undo ?? new BoardUndo();

            if (item == Board.Wall)
            {
                Board.Set(newPosition, Board.Empty, undo);
            }
            else if ("BFLR".Contains(item))
            {
                Boosts = Boosts.ToList();
                Boosts.Add(item);
                Board.Set(newPosition, Board.IsPainted(newPosition) ? Board.Empty : Board.UnpaintedEmpty, undo);
                ++BoostsCollected;
            }

            Paint(undo);

            return(Tuple.Create(this, undo));
        }
 public void UpdateSource(House house, List <EquipmentEquipped> equipment, Boosts boosts, ResTypes resType)
 {
     _House     = house;
     _Equipment = equipment;
     _Boosts    = boosts;
     ResType    = resType;
     RelicLevel = ResType.GetPartner(_Boosts);
     HouseLevel = ResType.GetPartner(_House);
 }
Esempio n. 3
0
        public int Remove(BoostSourceType sourceType)
        {
            List <BoostInfo> typedBoosts = FilterBoosts(sourceType);

            foreach (var boost in typedBoosts)
            {
                Boosts.Remove(boost.Id);
            }
            return(typedBoosts.Count);
        }
Esempio n. 4
0
 public void Load(BoostCollectionSave save)
 {
     save.Guard();
     Boosts.Clear();
     foreach (var kvp in save.boosts)
     {
         BoostInfo boost = new BoostInfo(kvp.Value);
         Add(boost);
     }
 }
Esempio n. 5
0
        public bool Remove(string id)
        {
            if (Boosts.ContainsKey(id))
            {
                Boosts.Remove(id);
                Recompute();
                return(true);
            }

            return(false);
        }
    private void Awake()
    {
        mBoosts = new Boosts();
        //set list
        mBoostList = new List <Func <float> >()
        {
            () => mBoosts.SpeedBoost(AssignedStation),
            () => mBoosts.CheapBoost(AssignedStation),
            () => mBoosts.EfficiencyBoost(AssignedStation)
        };

        //Set random boost to manager
        BoostFunction = mBoostList[UnityEngine.Random.Range(0, mBoostList.Count - 1)];
    }
Esempio n. 7
0
        public BattlePokemon(Pokemon p)
        {
            this.mon = p;
            maxHealth = mon.getRealStat("hp");
            currentHealth = maxHealth;
            status = Status.STATE_HEALTHY;
            currentBoosts = new Boosts();
            type1 = mon.type1;
            type2 = mon.type2;
            item = mon.item;
            level = 100; //TODO: actually find this, for now just assume its max.
            initBoosts();

           
        }
Esempio n. 8
0
 public Move(MoveJSONObj obj)
 {
     name = obj.name;
     type = Global.types[obj.type.ToLower()];
     bp = obj.basePower;
     accuracy = ((float)obj.accuracy / 100f);
     group = obj.category.ToLower();
     priority = obj.priority;
     boosts = obj.boosts;
     desc = obj.desc;
     statuseffect = obj.status;
     secondary = obj.secondary;
     if (statuseffect != "none") status = true;
     if (hasBoosts()) isBoost = true;
     if (Convert.ToBoolean(obj.flags.heal)) heal = true; 
     
 }
Esempio n. 9
0
        public List <BoostInfo> GetBoosts(string boostId)
        {
            var boosts = Boosts.Where(val => val.Key.Contains(boostId)).Select(val => val.Value).ToList();

            return(boosts);
        }
Esempio n. 10
0
 public double GetBoostValue(string boostId)
 => Boosts.ContainsKey(boostId) ? Boosts[boostId].Value : 1.0;
Esempio n. 11
0
 public void ClearAll()
 {
     Boosts.Clear();
 }
Esempio n. 12
0
        // Returns null if move is possible or state does not change
        // Mutates this.Board -- returns a BoardUndo that can revert the changes
        public Tuple <State, BoardUndo> Move(char move)
        {
            State     newState;
            BoardUndo undo = null;

            switch (move)
            {
            case 'W':     // up
                return(Move(new Point(0, 1)));

            case 'S':     // down
                return(Move(new Point(0, -1)));

            case 'A':     // left
                return(Move(new Point(-1, 0)));

            case 'D':     // right
                return(Move(new Point(1, 0)));

            case 'E':     // CW
            case 'Q':     // CCW
                newState       = CloneNextStep();
                newState.Robot = newState.Robot
                                 .Select(p => move == 'E' ? p.RotateRight() : p.RotateLeft())
                                 .ToList();
                newState.Direction = (newState.Direction + (move == 'E' ? 1 : 3)) % 4;
                undo = new BoardUndo();
                newState.Paint(undo);
                return(Tuple.Create(newState, undo));

            case 'F':     // fast wheels
                if (!Boosts.Any(i => i == Board.FastWheels))
                {
                    return(null);
                }

                newState = CloneNextStep();
                newState.FastWheelsTime = Math.Max(newState.FastWheelsTime + 50, 50);
                newState.Boosts         = newState.Boosts.ToList();
                newState.Boosts.Remove(Board.FastWheels);
                return(Tuple.Create(newState, undo));

            case 'L':     // drill
                if (!Boosts.Any(i => i == Board.Drill))
                {
                    return(null);
                }

                newState           = CloneNextStep();
                newState.DrillTime = Math.Max(newState.DrillTime + 30, 30);
                newState.Boosts    = newState.Boosts.ToList();
                newState.Boosts.Remove(Board.Drill);
                return(Tuple.Create(newState, undo));

            case 'R':     // teleport
                if (!Boosts.Any(i => i == Board.Teleport))
                {
                    return(null);
                }

                newState        = CloneNextStep();
                newState.Boosts = newState.Boosts.ToList();
                newState.Boosts.Remove(Board.Teleport);
                newState.Teleports = newState.Teleports.ToList();
                newState.Teleports.Add(Position);
                return(Tuple.Create(newState, (BoardUndo)null));

            case 'Z':
                return(Tuple.Create(CloneNextStep(), (BoardUndo)null));
            }

            return(null);
        }
Esempio n. 13
0
 public override string ToString()
 {
     return($"Remain={UnpaintedCount} Position={Position} Drill={DrillTime} Wheels={FastWheelsTime} Boosts={new string(Boosts.ToArray())}");
     //return $"Remain={UnpaintedCount} Drill={DrillTime} Wheels={FastWheelsTime} Boosts={new string(Boosts.ToArray())}\n{Board.ToString(Position)}";
 }
Esempio n. 14
0
 public PartnerBoostInfo(House house, List <EquipmentEquipped> equipment, Boosts boosts, ResTypes resType)
 {
     UpdateSource(house, equipment, boosts, resType);
 }