Page 1 of 1

Re: Change Logs

Posted: Sat Apr 19, 2014 7:20 pm
by Silly_Warlock
It seems Summon Demon is bugged, Nefer mentioned that he can't summon top demons with max ability level and 340 mana.
Like an idiot I decided to check the code, after a few hours of fighting the urge to hit the desk with my head (No offense to Ant, checking code without knowing its "roots" is a pain) I have found some conspicuous things:

1. That certainly looks like error:

Code: Select all

function int getCost()
{
	//Initial cost
	if (SelectedMonsterIndex < 0)
		return ManaCosts[0] * (1 + (0.02 * SummonMastery)) * (1 + (0.25 * ReapingEnergy));
	return (ManaCosts[SelectedMonsterIndex] * (1 + (0.02 * SummonMastery))) * (1 + (0.1 * ReapingEnergy)); //This part should run after we selected a monster, and it'll deduct the appropriate adren cost
}

// // (...)

//Now check for mana cost
	while(ManaCosts[i] * (1 + (0.02 * SummonMastery)) * (1 + (0.25 * ReapingEnergy)) > Instigator.Controller.Adrenaline)
	{
		i--;
		if (i <= 0)
			break;
	}
Ability info for Reaping Energy says it increases all summoning costs 10% per level as in getCost. In check, the artifact counts with 25%.

2.

Code: Select all

//Allow the monster to inherit the soul's strength
    SoulClass = InvSoul.SoulClasses[SelectedMonsterIndex];
Erm... SelectedMonsterIndex is what getCost uses (basically it's an index of monster to spawn, I believe), maybe it should be MonsterIndex or SoulIndex ?

3. From the other side, I have no idea what's going on here:

Code: Select all

for (i = 0; i < Inv.SummonedMonsters.length; i++)
            if (Inv.SummonedMonsters[i] == None || Inv.SummonedMonsters[i].Health <= 0)
                Inv.SummonedMonsters.Remove(i--, 1);
EDIT: 4. Forgot about it yesterday:

Code: Select all

 for (i = 0; i < RequiredScoringValues.length && i+1 < AbilityLevel; i++)
    {
		if (InvSoul.SoulClasses[MonsterIndex].default.ScoringValue < RequiredScoringValues[i])
		{
			i--;
			break;
		}
	}
Lets see the last possible 'i' that will pass into the loop- that would be 13(13 +1 < max AbilityLevel (15)), meaning monster number 13 (out of 14). If it passes the if in the loop we will have i++ and monster number 14 (last), that won't enter the loop. the problem is- What will check if we have a soul juicy enough for Mr 14 to nom ?
[/color]

Summon Demon bugs

Posted: Sat Apr 26, 2014 1:44 am
by DW_KarmaKat
Post moved from changlogs.

KKat

Re: Summon Demon bugs

Posted: Sat Apr 26, 2014 1:55 am
by DW_Ant
Silly_Warlock wrote:It seems Summon Demon is bugged, Nefer mentioned that he can't summon top demons with max ability level and 340 mana.
Like an idiot I decided to check the code, after a few hours of fighting the urge to hit the desk with my head (No offense to Ant, checking code without knowing its "roots" is a pain) I have found some conspicuous things:
No offense taken. Actually I appreciate this a lot! Although you should have visited me through vent or sent E-mails to save you from those headaches. There, I can explain class architecture, syntax, etc...


Silly_Warlock wrote:1. That certainly looks like error:

Code: Select all

//Now check for mana cost
	while(ManaCosts[i] * (1 + (0.02 * SummonMastery)) * (1 + (0.25 * ReapingEnergy)) > Instigator.Controller.Adrenaline)
	{
		i--;
		if (i <= 0)
			break;
	}
Ability info for Reaping Energy says it increases all summoning costs 10% per level as in getCost. In check, the artifact counts with 25%.
Nice catch, Silly! That's definitely a mistake. I've should have used a const variable defined in Reaping Energy to prevent disjointed values from other abilities.


Silly_Warlock wrote:2.

Code: Select all

//Allow the monster to inherit the soul's strength
    SoulClass = InvSoul.SoulClasses[SelectedMonsterIndex];
Erm... SelectedMonsterIndex is what getCost uses (basically it's an index of monster to spawn, I believe), maybe it should be MonsterIndex or SoulIndex ?
Nice catch on this one!
Unfortunately, you can't reference MonsterIndex since that's a local variable to a different function. However, I can call GetSoulIndex function instead.

Code: Select all

SoulClasses = InvSoul.SoulClasses[GetSoulIndex()];

Silly_Warlock wrote:3. From the other side, I have no idea what's going on here:

Code: Select all

for (i = 0; i < Inv.SummonedMonsters.length; i++)
            if (Inv.SummonedMonsters[i] == None || Inv.SummonedMonsters[i].Health <= 0)
                Inv.SummonedMonsters.Remove(i--, 1);
That's basically used to clean up the summoned monsters array.
When a necromancer summons a skeleton, a fire mage, and a forgotten, the summoned monster list will look like:
[0] Skeleton
[1] Fire Skeletal Mage
[2] Forgotten

When the Fire Skeletal Mage dies, the summoned monster list will transform into:
[0] Skeleton
[1] None
[2] Forgotten

The loop above basically removes the "None" elements. The health condition basically removes dead monsters from the array (Monsters with negative health values are still referenced in the array until they're removed from the level). This condition allows the Necromancers to immediately replace the monster(s) when they die instead of having them wait a few seconds.



Silly_Warlock wrote:EDIT: 4. Forgot about it yesterday:

Code: Select all

 for (i = 0; i < RequiredScoringValues.length && i+1 < AbilityLevel; i++)
    {
		if (InvSoul.SoulClasses[MonsterIndex].default.ScoringValue < RequiredScoringValues[i])
		{
			i--;
			break;
		}
	}
Lets see the last possible 'i' that will pass into the loop- that would be 13(13 +1 < max AbilityLevel (15)), meaning monster number 13 (out of 14). If it passes the if in the loop we will have i++ and monster number 14 (last), that won't enter the loop. the problem is- What will check if we have a soul juicy enough for Mr 14 to nom ?
This one is a bit complicated to explain. The loop will process i iterations ranging from (0-13). The i value does increment to 14, but the 14th value doesn't proceed to the loop. Although this may permit the Necromancer to summon a Sabaoth, the bug is that the score requirement only needs to satisfy level 14 requirement to be able to summon level 15 monster.

The patch will make this section easier to read as well.