public IEnumerator EquipTest1() { Character character = GameManager.CurrentLevel.GetCharacter(0, 0); Item item = IronSword.Create(); character.Equip(item); LogAssert.Expect(LogType.Error, "Iron Sword does not exist in inventory."); yield return(null); }
public IEnumerator ValidateRightPlacement() { Character sourceCharacter = GameManager.CurrentLevel.GetCharacter(0, 0); sourceCharacter.Items.Clear(); sourceCharacter.Items.Add(IronSword.Create()); sourceCharacter.AddProficiency(new Proficiency(typeof(Sword), Proficiency.Rank.A)); Character targetCharacter = GameManager.CurrentLevel.GetCharacter(0, 1); GameManager.AttackDetailPanel.Show(sourceCharacter, targetCharacter); Assert.True(GameManager.AttackDetailPanel.gameObject.activeSelf); yield return(null); }
public IEnumerator EndActionTest4() { Character sourceCharacter = GameManager.CurrentLevel.GetCharacter(2, 2); sourceCharacter.Items.Clear(); sourceCharacter.Items.Add(IronSword.Create()); sourceCharacter.Items.Add(Fire.Create()); Character targetCharacter = GameManager.CurrentLevel.GetCharacter(2, 1); targetCharacter.Items.Clear(); targetCharacter.Items.Add(Fire.Create()); // Move cursor yield return(MoveCursor(2, 2)); // select character yield return(Submit()); // select move yield return(Submit()); // select trade yield return(DownArrow()); yield return(Submit()); // select trading character yield return(Submit()); // trade item yield return(Submit()); Assert.AreEqual(1, sourceCharacter.Items.Count); Assert.AreEqual(2, targetCharacter.Items.Count); //Assert.AreEqual(Cursor.State.Free, GameManager.Cursor.CurrentState); Assert.True(GameManager.CurrentLevel.GetCharacter(2, 2).HasMoved); Assert.True(GameManager.CurrentLevel.GetCharacter(2, 2).HasTraded); Assert.False(GameManager.CurrentLevel.GetCharacter(2, 1).HasMoved); Assert.False(GameManager.CurrentLevel.GetCharacter(2, 1).HasTraded); }
public IEnumerator TradingTest3() { Character sourceCharacter = GameManager.CurrentLevel.GetCharacter(2, 2); sourceCharacter.Items.Clear(); sourceCharacter.Items.Add(IronSword.Create()); sourceCharacter.Items.Add(Fire.Create()); Character targetCharacter = GameManager.CurrentLevel.GetCharacter(2, 1); targetCharacter.Items.Clear(); targetCharacter.Items.Add(Fire.Create()); // Move cursor yield return(MoveCursor(2, 2)); // select character yield return(Submit()); // select move yield return(Submit()); // select trade yield return(DownArrow()); yield return(Submit()); // select trading character yield return(Submit()); yield return(Cancel()); Assert.False(GameManager.TradeDetailPanel.IsInFocus()); Assert.True(GameManager.Cursor.IsInFocus()); Assert.AreEqual(Cursor.State.ChoosingTradeTarget, GameManager.Cursor.CurrentState); }
public IEnumerator TradingTest2() { Character sourceCharacter = GameManager.CurrentLevel.GetCharacter(2, 2); sourceCharacter.Items.Clear(); sourceCharacter.Items.Add(IronSword.Create()); sourceCharacter.Items.Add(Fire.Create()); Character targetCharacter = GameManager.CurrentLevel.GetCharacter(2, 1); targetCharacter.Items.Clear(); targetCharacter.Items.Add(Fire.Create()); // Move cursor yield return(MoveCursor(2, 2)); // select character yield return(Submit()); // select move yield return(Submit()); // select trade yield return(DownArrow()); yield return(Submit()); // select trading character yield return(Submit()); yield return(Submit()); Assert.AreEqual(1, sourceCharacter.Items.Count); Assert.AreEqual(2, targetCharacter.Items.Count); yield return(DownArrow()); Assert.AreEqual(TradeDetailPanel.Side.SOURCE, GameManager.TradeDetailPanel.CurrentSide); // Press right yield return(RightArrow()); Assert.AreEqual(TradeDetailPanel.Side.DESTINATION, GameManager.TradeDetailPanel.CurrentSide); yield return(DownArrow()); Assert.AreEqual(TradeDetailPanel.Side.DESTINATION, GameManager.TradeDetailPanel.CurrentSide); yield return(DownArrow()); Assert.AreEqual(TradeDetailPanel.Side.DESTINATION, GameManager.TradeDetailPanel.CurrentSide); yield return(LeftArrow()); Assert.AreEqual(TradeDetailPanel.Side.SOURCE, GameManager.TradeDetailPanel.CurrentSide); yield return(LeftArrow()); Assert.AreEqual(TradeDetailPanel.Side.SOURCE, GameManager.TradeDetailPanel.CurrentSide); yield return(RightArrow()); Assert.AreEqual(TradeDetailPanel.Side.DESTINATION, GameManager.TradeDetailPanel.CurrentSide); yield return(Submit()); Assert.AreEqual(2, sourceCharacter.Items.Count); Assert.AreEqual(1, targetCharacter.Items.Count); }
/// <summary> /// Initialize the terrain map and characters. Should only be called by Level.Init(GameManager,Player,Player) /// </summary> protected override void Init() { TerrainMap = new Terrain.Terrain[4, 4]; CharacterMap = new Character[4, 4]; TerrainMap[0, 0] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[0, 1] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[0, 2] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[0, 3] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[1, 0] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[1, 1] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[1, 2] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[1, 3] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[2, 0] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[2, 1] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[2, 2] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[2, 3] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[3, 0] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[3, 1] = Create <Terrain.Terrain>(GameManager.GrassTerrain); TerrainMap[3, 2] = Create <Terrain.Terrain>(GameManager.WallTerrain); TerrainMap[3, 3] = Create <Terrain.Terrain>(GameManager.ForrestTerrain); CharacterMap[0, 0] = Create <Character>(GameManager.KnightPrefab); CharacterMap[0, 0].Player = AiPlayer; CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].Items.Add(IronSword.Create()); CharacterMap[0, 0].AddProficiency(new Proficiency(typeof(Sword), Proficiency.Rank.E)); CharacterMap[0, 1] = Create <Character>(GameManager.KnightPrefab); CharacterMap[0, 1].Player = AiPlayer; CharacterMap[0, 1].Items.Add(IronSword.Create()); CharacterMap[0, 2] = Create <Character>(GameManager.KnightPrefab); CharacterMap[0, 2].Player = AiPlayer; CharacterMap[0, 2].Items.Add(IronSword.Create()); CharacterMap[0, 3] = Create <Character>(GameManager.KnightPrefab); CharacterMap[0, 3].Player = AiPlayer; CharacterMap[0, 3].Items.Add(IronSword.Create()); CharacterMap[2, 3] = Create <Character>(GameManager.KnightPrefab); CharacterMap[2, 3].Player = AiPlayer; CharacterMap[2, 3].Items.Add(IronSword.Create()); CharacterMap[1, 2] = Create <Character>(GameManager.WizardPrefab); CharacterMap[1, 2].Player = AiPlayer; CharacterMap[1, 2].Items.Add(IronSword.Create()); CharacterMap[1, 2].Items.Add(Incinerate.Create()); CharacterMap[2, 2] = Create <Character>(GameManager.WizardPrefab); CharacterMap[2, 2].Player = HumanPlayer; CharacterMap[2, 2].Items.Add(IronSword.Create()); CharacterMap[2, 2].Items.Add(Fire.Create()); CharacterMap[2, 2].AddProficiency(new Proficiency(typeof(FireMagic), Proficiency.Rank.E)); CharacterMap[2, 2].AddProficiency(new Proficiency(typeof(HealingStaff), Proficiency.Rank.E)); CharacterMap[2, 1] = Create <Character>(GameManager.WizardPrefab); CharacterMap[2, 1].Player = HumanPlayer; CharacterMap[2, 1].CurrentHp = 10; CharacterMap[2, 1].AddProficiency(new Proficiency(typeof(HealingStaff), Proficiency.Rank.E)); CharacterMap[2, 1].Items.Add(Fire.Create()); CharacterMap[2, 1].AddProficiency(new Proficiency(typeof(FireMagic), Proficiency.Rank.E)); CharacterMap[3, 3] = Create <Character>(GameManager.KnightPrefab); CharacterMap[3, 3].Player = AiPlayer; CharacterMap[3, 3].Items.Add(IronAxe.Create()); StartPosition = new Vector2(0, 0); }