コード例 #1
0
 /***************************        FIGHTS      ***************************/
 public bool FightRandomMonster(bool possibleToEscape = false)
 {
     // player will fight against a random monster
     // returns battle result (true = victory)
     // xp can be gained here, but gold/items cannot (you can do this separately inside your interaction)
     // unlike fights with wild monsters, in this fight it is impossible to run away by default
     // if you want to make it possible to run away, provide the optional argument and set it to true
     try
     {
         Monster monster = Index.RandomMonsterFactory().Clone().Create();
         if (monster != null)
         {
             Display.BattleScene newBattleScene = new Display.BattleScene(parentPage, this, CurrentPlayer, monster);
             Battle newBattle = new Battle(this, newBattleScene, monster, false, possibleToEscape);
             newBattle.Run();
             if (newBattle.battleResult)
             {
                 UpdateStat(7, monster.XPValue);
             }
             return(newBattle.battleResult);
         }
     }
     catch (IndexOutOfRangeException e)
     {
         parentPage.AddConsoleText("Podjeto nieudana probe wygenerowania potwora. Czy klasa Index zostala zaktualizowana?");
         parentPage.AddConsoleText(e.Message);
     }
     return(false);
 }
コード例 #2
0
 public void FightThisMonster(Monster monster)
 {
     // player will fight against a particular monster
     // xp can be gained here, but gold/items cannot (you can do this separately inside your interaction)
     if (monster != null)
     {
         Display.BattleScene newBattleScene = new Display.BattleScene(parentPage, currentPlayer, monster);
         Battle newBattle = new Battle(this, newBattleScene, monster, false);
         newBattle.Run();
         if (newBattle.battleResult)
         {
             UpdateStat(7, monster.XPValue);
         }
     }
 }
コード例 #3
0
 public bool FightThisMonster(Monster monster, bool possibleToEscape = false)
 {
     // player will fight against a particular monster
     // returns battle result (true = victory)
     // xp can be gained here, but gold/items cannot (you can do this separately inside your interaction)
     // unlike fights with wild monsters, in this fight it is impossible to run away by default
     // if you want to make it possible to run away, provide the optional second argument and set it to true
     if (monster != null)
     {
         Display.BattleScene newBattleScene = new Display.BattleScene(parentPage, this, CurrentPlayer, monster);
         Battle newBattle = new Battle(this, newBattleScene, monster, false, possibleToEscape);
         newBattle.Run();
         if (newBattle.battleResult)
         {
             UpdateStat(7, monster.XPValue);
         }
         return(newBattle.battleResult);
     }
     return(true);
 }
コード例 #4
0
 /***************************        FIGHTS      ***************************/
 public void FightRandomMonster()
 {
     // player will fight against a random monster
     // xp can be gained here, but gold/items cannot (you can do this separately inside your interaction)
     try
     {
         Monster monster = Index.RandomMonsterFactory().Clone().Create(currentPlayer.Level);
         if (monster != null)
         {
             Display.BattleScene newBattleScene = new Display.BattleScene(parentPage, currentPlayer, monster);
             Battle newBattle = new Battle(this, newBattleScene, monster, false);
             newBattle.Run();
             if (newBattle.battleResult)
             {
                 UpdateStat(7, monster.XPValue);
             }
         }
     }
     catch (IndexOutOfRangeException e)
     {
         parentPage.AddConsoleText("An attempt was made to create a monster but something went wrong. Did you remember to update the Index class?");
         parentPage.AddConsoleText(e.Message);
     }
 }