iparalyze
iparalyze
CC#
Created by iparalyze on 11/14/2023 in #help
Issue with events
Looking at the GameEngine constructor, could it be a case of circular dependency?
public GameEngine(Party party) //First battle
{
Party = party;
TurnList = new List<ICharacter>();
//this.battleSeries = battleSeries;

party.AddCharacter(/*skeleton1 = */new Skeleton(1, 0, "Gomer"));
party.AddCharacter(/*skeleton2 = */new Skeleton(1, 0, "Nefasto"));
//party.AddCharacter(uncodedOne = new TheUncodedOne(1, 0));
BattleSeries = new BattleSeries(this);
BattleEnded += BattleSeries.OnBattleManager;
}
public GameEngine(Party party) //First battle
{
Party = party;
TurnList = new List<ICharacter>();
//this.battleSeries = battleSeries;

party.AddCharacter(/*skeleton1 = */new Skeleton(1, 0, "Gomer"));
party.AddCharacter(/*skeleton2 = */new Skeleton(1, 0, "Nefasto"));
//party.AddCharacter(uncodedOne = new TheUncodedOne(1, 0));
BattleSeries = new BattleSeries(this);
BattleEnded += BattleSeries.OnBattleManager;
}
11 replies
CC#
Created by iparalyze on 11/14/2023 in #help
Issue with events
I did, and I'm thinking there must be something in the third constructor, or in the event manager in BattleSeries
11 replies
CC#
Created by iparalyze on 11/14/2023 in #help
Issue with events
I've just noticed that if I move the BattleSeries.CurrentBattleNumber++; in the second constructor, the game stops when the two heroes win the first battle...
11 replies
CC#
Created by iparalyze on 11/14/2023 in #help
Issue with events
I really don't know what to do...
11 replies
CC#
Created by iparalyze on 11/14/2023 in #help
Issue with events
Mm the logic inside the TurnsManager method should check for the property hero.IsDead, not if the character is present... Characters are not eliminated from the list when they die, only their property goes from IsDead = false to true
11 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
The problem was that foreach inside a while loop. If you want to have a look at it it's now working. I found a way to breakaway from both the for and the while loop using a bool variable. Well chatgpt suggested it, and for once I have to admit it's working... You can check out the latest commit on github. Thanks a lot for taking a look at my code
20 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
I placed a debugger inside the AreYouDead list. It shows that everything is getting updated correctly. Well now the characters get eliminated from the lists but if you remove
`if (cAttacked.CharacterCategory == Category.Hero)
Party.HeroesParty.Remove(cAttacked);
else Party.MonstersParty.Remove(cAttacked);
`if (cAttacked.CharacterCategory == Category.Hero)
Party.HeroesParty.Remove(cAttacked);
else Party.MonstersParty.Remove(cAttacked);
you will see it works
20 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
I did, I've been running around in circles, the IsDead gets updated correctly, there must be something in the logic of TurnsManager() that is wrong... I wish I could figure out what that is...
20 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
that was my first option but it didn't work
20 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
if (Party.HeroesParty.Count ==0/All(hero => hero.IsDead)/ || Party.MonstersParty.Count ==0) but this should exit the while loop right?
20 replies
CC#
Created by iparalyze on 11/9/2023 in #help
❔ Looping problem
Thank you for pointing out the issues, I'll definitely sort them out later. I'm not sure they're impacting the current problem I have. I don't understand why the turn manager doesn't stop when all monsters are dead. this is how far I've gotten but it's still giving me the same issue. I gave up on IsDead and now I'm removing characters from the lists and check if (Party.HeroesParty.Count ==0 || Party.MonstersParty.Count ==0) but still nothing... https://github.com/aleviti2/FInal-Battle
20 replies
CC#
Created by iparalyze on 11/6/2023 in #help
❔ Issue with a Property
You're a GOD!!! Thank you
4 replies