Exemplo n.º 1
0
 public void RunCurrentPassiveEvent(PlayerHandler player, Random rando, UI_Helper uihelper)
 {
     safeTilesRemaining = passiveEventSafeTiles;
     currentEvent.PerformPassiveEventActivity(player, rando);
     CreateTravelFeed(currentEvent.ReturnEventText(), uihelper);
     ConsoleLogEvent();
     ClearEvent();
 }
Exemplo n.º 2
0
        public void CheckForValidSleepEvents(PlayerHandler player, DataManager datamanager, Random rando, GridTile.GridTerrain terraintype, Boolean isonroad, WorldMap world, int hour, UI_Helper uihelper)
        {
            List <Event> possibleEvents = new List <Event>();

            RestSafeTick();

            //check for valid sleep events
            foreach (KeyValuePair <String, Event> e in datamanager.passiveEventData)
            {
                //check if this is a sleep specific event
                if ((e.Value.CanOccurWhenSleeping() == true && e.Value.CanOccurWhenSleeping() == false) ||
                    (e.Value.OccursWhenWakingUp() == true && currentWakeEvent == null))
                {
                    //add any eligible people to event
                    Event newevent = CheckIfPeopleEligible(e.Value, player);
                    //determine the text used
                    newevent.DetermineValidText(rando);
                    //if eligible people exist, add to event
                    if (newevent.IsEligibleExists() == true && newevent.CheckForGridRequirements(terraintype, isonroad) == true &&
                        newevent.CheckForPartySizeRequirements(player.partyMembers.Count) == true)
                    {
                        possibleEvents.Add(newevent);
                    }
                }
            }


            for (int i = 0; i < possibleEvents.Count; ++i)
            {
                int rand = rando.Next(0, 101);
                if (rand < possibleEvents[i].ReturnEventChance())
                {
                    if (possibleEvents[i].OccursWhenWakingUp() == true)
                    {
                        SetCurrentWakeEventEvent(possibleEvents[i], true, rando, player, "");
                    }
                    else if (restSafeTilesRemaining == 0)
                    {
                        SetCurrentPassiveEvent(possibleEvents[i], true, rando, player, "");
                        RunCurrentPassiveEvent(player, rando, uihelper);
                        RestSafeSet();
                    }
                    break;
                }
            }
        }
Exemplo n.º 3
0
        //returns minutes to tick down
        //this performs all checks/stat changes, etc for travelling
        public int TravelTick(PlayerHandler player, DataManager datamanager, Random rando, UI_Helper uihelper, GridTile.GridTerrain gridTerrainType, Boolean isOnRoad, WorldMap world, int hour)
        {
            int value = 0;

            //if at destination
            if (currentTravelDistance == totalTravelDistance)
            {
                //check for event
                if (currentGridLocation != travelStartingLocation &&
                    safeTilesRemaining == 0)
                {
                    CheckForValidEvents(player, datamanager, rando, gridTerrainType, isOnRoad, world, hour);
                }


                //if world event
                if (currentWorldEvent != null)
                {
                    safeTilesRemaining = worldEventSafeTiles;
                    uihelper.CreateEventUI(currentWorldEvent);
                }
                //if passive event
                else if (currentEvent != null)
                {
                    RunCurrentPassiveEvent(player, rando, uihelper);
                    //safeTilesRemaining = passiveEventSafeTiles;
                    //currentEvent.PerformPassiveEventActivity(player, rando);
                    //CreateTravelFeed(currentEvent.ReturnEventText(), uihelper);
                    // ConsoleLogEvent();
                    //ClearEvent();
                }
                //if no event
                else
                {
                    if (safeTilesRemaining > 0)
                    {
                        safeTilesRemaining -= 1;
                    }
                    //player basic ticks
                    player.LoseStamina(PlayerHandler.StaminaDrainType.Travel);
                    player.LoseRested(PlayerHandler.RestedLossType.Travel);
                }


                //get next distance
                currentGridLocation += new Point((int)(totalTravelDistance.X / 64), (int)(totalTravelDistance.Y / 64));
                for (int i = 0; i < travelPath.Count; ++i)
                {
                    if (travelPath[i].routeLocation == currentGridLocation)
                    {
                        totalTravelDistance   = travelPath[i].getDirection();
                        currentTravelDistance = Vector2.Zero;
                        if (totalTravelDistance == Vector2.Zero)
                        {
                            value = -1;
                        }
                        else
                        {
                            value = travelPath[i].GetTravelEstimate();
                        }
                        break;
                    }
                }
            }

            //move
            currentTravelDistance.X += totalTravelDistance.X / 64;
            currentTravelDistance.Y += totalTravelDistance.Y / 64;



            return(value);
        }
Exemplo n.º 4
0
 void CreateTravelFeed(String text, UI_Helper uihelper)
 {
     uihelper.CreateTravelFeed(text);
 }
Exemplo n.º 5
0
        public void DetermineEventOutcome(PlayerHandler player, GameMain game, TravelHandler travel, Random rando, UI_Helper uihelper)
        {
            //determine success or failure of the outcome and return the outcome
            EventOptionOutcomes thisOutcome = CheckForSuccessOrFail(player, rando);


            //take actions depending on what the event outcome's transition is
            if (thisOutcome.thisNextTransition == EventOptionOutcomes.NextTransition.BackToTravelSilent)
            {
                travel.ClearWorldEvent();
            }
            else if (thisOutcome.thisNextTransition == EventOptionOutcomes.NextTransition.Combat)
            {
                //TODO: Add Combat
                //game.ChangeGameState(GameMain.GameState.Combat);
                travel.ClearWorldEvent();
            }
            else if (thisOutcome.thisNextTransition == EventOptionOutcomes.NextTransition.PassiveEvent)
            {
                Event thisPassiveEvent = game.dataManager.passiveEventData[thisOutcome.GetPassiveEventString()];
                thisPassiveEvent.DetermineValidText(rando);
                travel.SetCurrentPassiveEvent(thisPassiveEvent, false, rando, player, travel.GetWorldEventCreatureName());
                travel.ClearWorldEvent();
                travel.RunCurrentPassiveEvent(player, rando, uihelper);
            }
        }