/// <summary> /// Returns whether there was randomness involved in drinking the potion. /// </summary> public bool DrinkPotion(Potion p, Enemy enemy) { if (!PlayerTurn) { throw new Exception("Not your turn"); } var fakePotion = _Player.Potions.First(el => el.ToString() == p.ToString()); _Player.Potions.Remove(fakePotion); var history = new List <string>(); var ef = new EffectSet(); p.Apply(this, _Player, enemy, ef); ApplyEffectSet(ef, _Player, enemy, history); AssignLastAction(new FightAction(FightActionEnum.Potion, potion: p, target: enemy, history: history, hadRandomEffects: ef.HadRandomness, key: ef.Key)); return(false); }
public List <string> GetList() { var label = FightActionType.ToString(); //Certain types are always labelled switch (FightActionType) { case FightActionEnum.PlayCard: label = $"{CardInstance}"; break; case FightActionEnum.Potion: label = "Potion:" + Potion.ToString(); break; case FightActionEnum.EnemyDied: label = $"Enemy {Target} died"; break; case FightActionEnum.StartTurn: break; case FightActionEnum.EndTurn: case FightActionEnum.WonFight: case FightActionEnum.LostFight: case FightActionEnum.TooLong: break; case FightActionEnum.EnemyMove: break; case FightActionEnum.StartFight: break; case FightActionEnum.StartFightEffect: case FightActionEnum.EndFightEffect: case FightActionEnum.StartTurnEffect: case FightActionEnum.EndTurnEffect: case FightActionEnum.EndTurnDeckEffect: case FightActionEnum.EndTurnOtherEffect: case FightActionEnum.EndEnemyTurn: break; case FightActionEnum.NotInitialized: break; default: throw new System.Exception(); } //we always return a fighthistory. var res = new List <string>() { label }; if (History != null) { res.AddRange(History); } if (Random) { //possibly unnecessary in interactive context. res.Add($" R:{Key}"); } return(res); }