Example #1
0
        public int ExtinguishAll(Firefighter firefighter, Field destination)
        {
            int fireLevel = (int)((Room)destination).FireState;

            ((Room)destination).ExtinguishFire(fireLevel);

            return fireLevel * firefighter.ActionCosts[ActionName.ExtinguishToSmoke];
        }
Example #2
0
        public int ExtinguishSmoke(Firefighter firefighter, Field destination)
        {
            ((Room)destination).ExtinguishFire(1);

            return firefighter.ActionCosts[ActionName.ExtinguishToSmoke];
        }
Example #3
0
        public int PutPOI(Firefighter firefighter, Field destination)
        {
            if(firefighter.Carry != null && firefighter.Carry == Marker.Victim)
            {
                firefighter.Carry = null;

                return firefighter.ActionCosts[ActionName.PutPOI];
            }

            return 0;
        }
Example #4
0
        private bool AreAdjacent(Field a, Field b)
        {
            int rowMovement = Math.Abs (a.Row - b.Row);
            int colMovement = Math.Abs (a.Column - b.Column);

            if (!(a is Room) || !(b is Room))
                return false;

            if((colMovement == 2 && rowMovement == 0) || (colMovement == 0 && rowMovement == 2))
                return true;

            return false;
        }
Example #5
0
        public int PutHazard(Firefighter firefighter, Field destination)
        {
            if (firefighter.Carry != null && firefighter.Carry == Marker.Hazard)
            {
                firefighter.Carry = null;

                return firefighter.ActionCosts[ActionName.PutHazard];
            }

            return 0;
        }
Example #6
0
 public int PickPOI(Firefighter firefighter, Field destination)
 {
     if((destination as Room).OnField[Marker.Victim] > 0 && firefighter.Carry == null)
     {
         firefighter.Carry = Marker.Victim;
         return firefighter.ActionCosts[ActionName.PickPOI];
     }
     return 0;
 }
Example #7
0
 public int PickHazard(Firefighter firefighter, Field destination)
 {
     if ((destination as Room).OnField[Marker.Hazard] > 0 && firefighter.Carry == null)
     {
         firefighter.Carry = Marker.Hazard;
         return firefighter.ActionCosts[ActionName.PickHazard];
     }
     return 0;
 }
Example #8
0
        public int Move(Firefighter firefighter, Field destination)
        {
            if (!(destination is Room))
                return 0;

            if (!AreAdjacent (firefighter.Position, destination))
                return 0;

            int cost = firefighter.ActionCosts [ActionName.Move];
            if (((Room)destination).FireState == FireState.Fire) {
                cost *= 2;
            }

            firefighter.Position = destination;
            IdentifyPOI(firefighter, destination);

            return cost;
        }
Example #9
0
        //TO DO: Rest;
        public int IdentifyPOI(Firefighter firefighter, Field destination)
        {
            if(firefighter.Position == destination && (destination is Room) && (destination as Room).OnField[Marker.UncoveredPoi] > 0)
            {
                (destination as Room).TakeMarker(Marker.UncoveredPoi);
                Random r = new Random();
                int chance = r.Next(3);
                if(chance == 2 && GameValues.FalseAlarms > 0)
                {
                    return 0;
                }

                (destination as Room).PutMarker(Marker.Victim);

                return firefighter.ActionCosts[ActionName.IdentifyPOI];
            }
            return 0;
        }