@@ -24,48 +24,21 @@ contract BattleNadsCombatTest is BattleNadsBaseTest, Constants {
2424 character1 = _createCharacterAndSpawn (1 , "Fighter " , 6 , 6 , 5 , 5 , 5 , 5 , userSessionKey1, uint64 (type (uint64 ).max));
2525 character2 = _createCharacterAndSpawn (2 , "Defender " , 5 , 7 , 5 , 5 , 5 , 5 , userSessionKey2, uint64 (type (uint64 ).max));
2626
27- // If either character is a Bard (class 4), recreate them
27+ // If either character is a Bard (class 4), change their class to Fighter
2828 // Bards have ineffective abilities that can stall combat tests
29- _ensureNotBard (1 );
30- _ensureNotBard (2 );
31- }
32-
33- function _ensureNotBard (uint256 characterIndex ) internal {
34- bytes32 charId = characterIndex == 1 ? character1 : character2;
35- BattleNad memory nad = battleNads.getBattleNad (charId);
36-
37- if (uint8 (nad.stats.class) == 4 ) { // Bard class
38- console.log ("Character " , characterIndex, "is a Bard - recreating to avoid test issues " );
39-
40- // Create a new character until we get a non-Bard
41- uint256 attempts = 0 ;
42- while (uint8 (nad.stats.class) == 4 && attempts < 10 ) {
43- string memory name = characterIndex == 1 ? "Fighter " : "Defender " ;
44- address sessionKey = characterIndex == 1 ? userSessionKey1 : userSessionKey2;
45- address owner = characterIndex == 1 ? user1 : user2;
46-
47- uint256 creationCost = battleNads.estimateBuyInAmountInMON ();
48- vm.prank (owner);
49- charId = battleNads.createCharacter { value: creationCost }(
50- name, 6 , 6 , 5 , 5 , 5 , 5 , sessionKey, uint64 (type (uint64 ).max)
51- );
52-
53- _waitForSpawn (charId);
54- nad = battleNads.getBattleNad (charId);
55- attempts++ ;
56- }
57-
58- // Update the character reference
59- if (characterIndex == 1 ) {
60- character1 = charId;
61- } else {
62- character2 = charId;
63- }
64-
65- require (uint8 (nad.stats.class) != 4 , "Could not create non-Bard character after multiple attempts " );
29+ BattleNad memory nad1 = battleNads.getBattleNad (character1);
30+ BattleNad memory nad2 = battleNads.getBattleNad (character2);
31+ if (uint8 (nad1.stats.class) == 4 ) {
32+ console.log ("Character1 is a Bard - changing to Fighter class " );
33+ _modifyCharacterStat (character1, "class " , 5 );
34+ }
35+ if (uint8 (nad2.stats.class) == 4 ) {
36+ console.log ("Character2 is a Bard - changing to Fighter class " );
37+ _modifyCharacterStat (character2, "class " , 5 );
6638 }
6739 }
6840
41+
6942 // =============================================================================
7043 // COMBAT ENTRY AND FORBIDDEN ACTIONS
7144 // =============================================================================
0 commit comments