Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to BattleCry & Blood Moon - Beast Ascending #1032

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion Client/MirGraphics/MLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private static void LoadGameLibraries()
Progress++;
MagicC.Initialize();
Progress++;

Effect.Initialize();
Progress++;

Expand Down
7 changes: 7 additions & 0 deletions Client/MirObjects/PlayerObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,13 @@ public virtual void SetAction()

#endregion

#region BeastsAscending

case Spell.BeastsAscending:
Effects.Add(new Effect(Libraries.Magic3, 200, 8, Frame.Count * FrameInterval, this));
break;

#endregion
}


Expand Down
8 changes: 7 additions & 1 deletion Client/MirScenes/Dialogs/MainDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3450,6 +3450,10 @@ public void Update(ClientMagic magic)
case Spell.BladeAvalanche:
SkillButton.Hint = string.Format("Blade Avalanche\n\nActive Skill\nMana Cost {2}\n\nHurls blades in three directions in front of the\ncaster, creating a deadly storm of metal\n\nCurrent Skill Level {0}\nNext Level {1}", Magic.Level, Magic.Level == 0 ? Magic.Level1 : Magic.Level == 1 ? Magic.Level2 : Magic.Level == 2 ? Magic.Level3 : 0, Magic.BaseCost);
break;
case Spell.BattleCry:
SkillButton.Hint = string.Format("BattleCry\n\nActive Skill\nMana Cost: {2}\n\nChanges Monsters attacking focus to caster\nSuccess increases with skill level.\n\nCurrent Skill Level {0}\nNext Level {1}", Magic.Level, Magic.Level == 0 ? Magic.Level1 : Magic.Level == 1 ? Magic.Level2 : Magic.Level == 2 ? Magic.Level3 : 0, Magic.BaseCost);
break;


//Wizard
case Spell.FireBall:
Expand Down Expand Up @@ -3607,7 +3611,9 @@ public void Update(ClientMagic magic)
case Spell.PetEnhancer:
SkillButton.Hint = string.Format("Pet Enhancer\n\nInstant Casting\nMana Cost {2}\n\nStrengthening pets defence and power.\n\nCurrent Skill Level {0}\nNext Level {1}", Magic.Level, Magic.Level == 0 ? Magic.Level1 : Magic.Level == 1 ? Magic.Level2 : Magic.Level == 2 ? Magic.Level3 : 0, Magic.BaseCost);
break;

case Spell.BeastsAscending:
SkillButton.Hint = string.Format("Beast's Ascending\n\nYou will be able to summon all summons at once\nwhile possessing Blood Dragon Beast's energy\nSummons take a damage reduction from Monsters\n\nCurrent Skill Level {0}\nNext Level {1}", Magic.Level, Magic.Level == 0 ? Magic.Level1 : Magic.Level == 1 ? Magic.Level2 : Magic.Level == 2 ? Magic.Level3 : 0, Magic.BaseCost);
break;
//Assassin
case Spell.FatalSword:
SkillButton.Hint = string.Format("Fatal Sword\n\nPassive Skill\n\nIncrease attack damage on the monsters.\nalso increases accuracy a little.\nPassive Skill\n\nCurrent Skill Level {0}\nNext Level {1}", Magic.Level, Magic.Level == 0 ? Magic.Level1 : Magic.Level == 1 ? Magic.Level2 : Magic.Level == 2 ? Magic.Level3 : 0, Magic.BaseCost);
Expand Down
1 change: 1 addition & 0 deletions Server/MirEnvir/Envir.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ private void FillMagicInfoList()
if (!MagicExists(Spell.BattleCry)) MagicInfoList.Add(new MagicInfo { Name = "BattleCry", Spell = Spell.BattleCry, Icon = 42, Level1 = 48, Level2 = 51, Level3 = 55, Need1 = 8000, Need2 = 11000, Need3 = 15000, BaseCost = 22, LevelCost = 10, Range = 0 });
if (!MagicExists(Spell.FireBounce)) MagicInfoList.Add(new MagicInfo { Name = "FireBounce", Spell = Spell.FireBounce, Icon = 4, Level1 = 15, Level2 = 18, Level3 = 21, Need1 = 2000, Need2 = 2700, Need3 = 3500, BaseCost = 5, LevelCost = 1, MPowerBase = 6, PowerBase = 10, Range = 9 });
if (!MagicExists(Spell.MeteorShower)) MagicInfoList.Add(new MagicInfo { Name = "MeteorShower", Spell = Spell.MeteorShower, Icon = 4, Level1 = 15, Level2 = 18, Level3 = 21, Need1 = 2000, Need2 = 2700, Need3 = 3500, BaseCost = 5, LevelCost = 1, MPowerBase = 6, PowerBase = 10, Range = 9 });
if (!MagicExists(Spell.BeastsAscending)) MagicInfoList.Add(new MagicInfo { Name = "BeastsAscending", Spell = Spell.BeastsAscending, Icon = 16, Level1 = 19, Level2 = 22, Level3 = 26, Need1 = 23600, Need2 = 38900, Need3 = 57900, BaseCost = 12, LevelCost = 4, Range = 0 });
}

private string CanStartEnvir()
Expand Down
3 changes: 2 additions & 1 deletion Server/MirEnvir/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,15 @@ private void CompleteMagic(IList<object> data)

#endregion

#region SummonSkeleton, SummonShinsu, SummonHolyDeva, ArcherSummons
#region SummonSkeleton, SummonShinsu, SummonHolyDeva, ArcherSummons, BeastsAscending

case Spell.SummonSkeleton:
case Spell.SummonShinsu:
case Spell.SummonHolyDeva:
case Spell.SummonVampire:
case Spell.SummonToad:
case Spell.SummonSnakes:
case Spell.BeastsAscending:
monster = (MonsterObject)data[2];
front = (Point)data[3];

Expand Down
75 changes: 75 additions & 0 deletions Server/MirObjects/HumanObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3740,6 +3740,9 @@ public void Magic(Spell spell, MirDirection dir, uint targetID, Point location,
case Spell.FireBounce:
if (!FireBounce(target, magic, this)) targetID = 0;
break;
case Spell.BeastsAscending:
BeastsAscending(magic);
break;
default:
cast = false;
break;
Expand Down Expand Up @@ -5725,6 +5728,78 @@ private bool MeteorShower(MapObject target, UserMagic magic)

return true;
}

private List<string> summonableMonsters = new List<string> { Settings.SkeletonName, Settings.ShinsuName, Settings.AngelName };

private void BeastsAscending(UserMagic magic)
{
ResummonAll(magic);
}

private void SummonMonster(string monsterName, int amuletType, UserMagic magic)
{
for (int i = 0; i < Pets.Count; i++)
{
var monster = Pets[i];
if (monster.Info.Name == monsterName && !monster.Dead)
{
return;
}
}

if (Pets.Count(x => x.Race == ObjectType.Monster) >= 3) return;

UserItem item = GetAmulet(amuletType);
if (item == null) return;

MonsterInfo info = Envir.GetMonsterInfo(monsterName);
if (info == null) return;

LevelMagic(magic);

ConsumeItem(item, (byte)amuletType);

var newMonster = MonsterObject.GetMonster(info);
newMonster.PetLevel = magic.Level;
newMonster.Master = this;

if (monsterName == Settings.SkeletonName)
{
newMonster.MaxPetLevel = (byte)(4 + magic.Level);
}
else
{
newMonster.MaxPetLevel = (byte)(1 + magic.Level * 2);
}

// Set the damage reduction for summoned monsters
newMonster.DamageReduction = 0.75f; // 25% less damage

newMonster.Direction = Direction;
newMonster.ActionTime = Envir.Time + 1000;

DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, newMonster, Front);
CurrentMap.ActionList.Add(action);
}

// Resummon all monsters if any one has died
private void ResummonAll(UserMagic magic)
{
foreach (var monsterName in summonableMonsters)
{
int amuletType = GetAmuletType(monsterName);
SummonMonster(monsterName, amuletType, magic);
}
}

private int GetAmuletType(string monsterName)
{
if (monsterName == Settings.SkeletonName) return 1;
if (monsterName == Settings.ShinsuName) return 5;
if (monsterName == Settings.AngelName) return 2;

return 0;
}

#endregion

Expand Down
44 changes: 44 additions & 0 deletions Server/MirObjects/MonsterObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,55 @@ public override sealed PetMode PMode
}
}

private int hp;
private int level;

public override int Health
{
get { return HP; }
}

public float DamageReduction { get; set; } = 0.75f; // 25% less damage received by default

public float CalculateDamageReduction(int spellLevel)
{
float baseReduction = 0.25f;
switch (level)
{
case 1:
baseReduction += 0.03f; // Additional 3%
break;
case 2:
baseReduction += 0.05f; // Additional 5%
break;
case 3:
baseReduction += 0.07f; // Additional 7%
break;
}

baseReduction += 0.02f * spellLevel; // Additional 2% per spell level
if (baseReduction > 1.0f) baseReduction = 1.0f; // Cap at 100%

return baseReduction;
}

public void SetHealth(int value)
{
hp = value < 0 ? 0 : value; // Ensure HP cannot be negative
}

public void TakeDamage(int damage, int spellLevel)
{
float damageReduction = CalculateDamageReduction(spellLevel);
int reducedDamage = (int)(damage * (1 - damageReduction));
SetHealth(hp - reducedDamage);

if (Health == 0)
{
Die();
}
}

public override int MaxHealth
{
get { return Stats[Stat.HP]; }
Expand Down
1 change: 1 addition & 0 deletions Shared/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ public enum Spell : byte
BattleCry = 153,
FireBounce = 154,
MeteorShower = 155,
BeastsAscending = 156,

//Map Events
DigOutZombie = 200,
Expand Down