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); }
public int Remove(BoostSourceType sourceType) { List <BoostInfo> typedBoosts = FilterBoosts(sourceType); foreach (var boost in typedBoosts) { Boosts.Remove(boost.Id); } return(typedBoosts.Count); }
public void Load(BoostCollectionSave save) { save.Guard(); Boosts.Clear(); foreach (var kvp in save.boosts) { BoostInfo boost = new BoostInfo(kvp.Value); Add(boost); } }
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)]; }
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(); }
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; }
public List <BoostInfo> GetBoosts(string boostId) { var boosts = Boosts.Where(val => val.Key.Contains(boostId)).Select(val => val.Value).ToList(); return(boosts); }
public double GetBoostValue(string boostId) => Boosts.ContainsKey(boostId) ? Boosts[boostId].Value : 1.0;
public void ClearAll() { Boosts.Clear(); }
// 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); }
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)}"; }
public PartnerBoostInfo(House house, List <EquipmentEquipped> equipment, Boosts boosts, ResTypes resType) { UpdateSource(house, equipment, boosts, resType); }