예제 #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];
        }
예제 #2
0
        public int ExtinguishSmoke(Firefighter firefighter, Field destination)
        {
            ((Room)destination).ExtinguishFire(1);

            return firefighter.ActionCosts[ActionName.ExtinguishToSmoke];
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
 }
예제 #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;
 }
예제 #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;
        }
예제 #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;
        }