Exemplo n.º 1
0
        public override void Use(Player player)
        {
            Mob target = player.Champion.Target;

            if (target == null)
            {
                Output.WriteGenericText(Output.NoTarget);
            }
            else
            {
                if (GenericOperations.FetchRandomPercentage() <= (CalculateChance(target)))
                {
                    target.ResetMob();

                    Output.WriteGenericText(GetItemUsedMessage());

                    Deplete(player);

                    player.OwnedMobs.Add(Mob.InstantiateMob(target, false));
                    if (player.CurrentLocation is Encounter e)
                    {
                        e.FinishCombat(player, Output.ComposeGenericText(new string[] { target.Name, Output.CapturedLabel }), true);
                        return;
                    }
                    target = null;
                    Controls.GoBackAction(player);
                }
                else
                {
                    Output.WriteCleanPause(Output.CaptureFailureSentence);
                }
            }
        }
Exemplo n.º 2
0
 public static void FleeAction(Player p)
 {
     if (GenericOperations.FetchRandomPercentage() < Settings.FleeChance)
     {
         Console.Clear();
         if (p.CurrentLocation is Encounter e)
         {
             e.FinishCombat(p, Output.FleeSuccessSentence);
         }
     }
     else
     {
         Output.WriteCleanPause(Output.FleeFailureSentence);
         p.Champion.ActionsLeft--;
     }
 }
Exemplo n.º 3
0
        private Mob SelectEncounterMob()
        {
            float percentage = GenericOperations.FetchRandomPercentage();

            List <Mob> encounterable;

            if (percentage < Settings.NativeWildlifeChance / 2f)
            {
                encounterable = Data.Mobs.Where(t => t.Type == endpoints[0].TownType).ToList();
            }
            else if (percentage < Settings.NativeWildlifeChance)
            {
                encounterable = Data.Mobs.Where(t => t.Type == endpoints[1].TownType).ToList();
            }
            else
            {
                encounterable = Data.Mobs;
            }
            return(PickMob(encounterable));
        }