From db2e5ee372847f2ad22bcdf0161b3983f26f8e94 Mon Sep 17 00:00:00 2001 From: samfrjn11 Date: Wed, 9 Aug 2023 23:02:08 +0200 Subject: [PATCH 1/4] Update functions.php Updated combat_level formula to include Necromancy skill. --- src/RS3/functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RS3/functions.php b/src/RS3/functions.php index f8e3c0c..872f7de 100644 --- a/src/RS3/functions.php +++ b/src/RS3/functions.php @@ -49,12 +49,14 @@ function combat_level( Stat $defence, Stat $constitution, Stat $prayer, - Stat $summoning + Stat $summoning, + Stat $necromancy ): int { $highest = max( $attack->getLevel() + $strength->getLevel(), 2 * $magic->getLevel(), - 2 * $ranged->getLevel() + 2 * $ranged->getLevel(), + 2 * $necromancy->getLevel() ); $rest = ( From 9118714e5e01db9e091c0199a633557663760b2c Mon Sep 17 00:00:00 2001 From: samfrjn11 Date: Wed, 9 Aug 2023 23:10:30 +0200 Subject: [PATCH 2/4] Update CombatLevelTest.php Updated tests to include Necromancy calculations --- tests/RS3/CombatLevelTest.php | 69 +++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/tests/RS3/CombatLevelTest.php b/tests/RS3/CombatLevelTest.php index b829862..6e3810c 100644 --- a/tests/RS3/CombatLevelTest.php +++ b/tests/RS3/CombatLevelTest.php @@ -13,6 +13,7 @@ use RuneStat\RS3\Skills\Ranged; use RuneStat\RS3\Skills\Strength; use RuneStat\RS3\Skills\Summoning; +use RuneStat\RS3\Skills\Necromancy; use RuneStat\RS3\Stats\Stat; use function RuneStat\RS3\combat_level; @@ -30,7 +31,8 @@ public function it_calculates_the_minimum_combat_level(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(3, $combat); @@ -47,10 +49,11 @@ public function it_calculates_the_maximum_combat_level(): void new Stat(new Defence(), 99, 1, 1, 1), new Stat(new Constitution(), 99, 99, 1, 1), new Stat(new Prayer(), 99, 1, 1, 1), - new Stat(new Summoning(), 99, 1, 1, 1) + new Stat(new Summoning(), 99, 1, 1, 1), + new Stat(new Necromancy(), 120, 120, 1, 1) ); - $this->assertSame(138, $combat); + $this->assertSame(152, $combat); } /** @test */ @@ -64,7 +67,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_attack(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(35, $combat); @@ -81,7 +85,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_strength(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(35, $combat); @@ -98,7 +103,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_magic(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(67, $combat); @@ -115,7 +121,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_ranged(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(67, $combat); @@ -132,7 +139,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_defence(): void new Stat(new Defence(), 99, 99, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(27, $combat); @@ -149,7 +157,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_constitution(): new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 99, 9, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(25, $combat); @@ -166,7 +175,8 @@ public function it_calculates_the_combat_level_with_ninety_nine_prayer(): void new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 99, 99, 1, 1), - new Stat(new Summoning(), 1, 1, 1, 1) + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(15, $combat); @@ -183,9 +193,46 @@ public function it_calculates_the_combat_level_with_ninety_nine_summoning(): voi new Stat(new Defence(), 1, 1, 1, 1), new Stat(new Constitution(), 10, 10, 1, 1), new Stat(new Prayer(), 1, 1, 1, 1), - new Stat(new Summoning(), 99, 99, 1, 1) + new Stat(new Summoning(), 99, 99, 1, 1), + new Stat(new Necromancy(), 1, 1, 1, 1) ); $this->assertSame(15, $combat); } + + /** @test */ + public function it_calculates_the_combat_level_with_ninety_nine_necromancy(): void + { + $combat = combat_level( + new Stat(new Attack(), 1, 1, 1, 1), + new Stat(new Strength(), 1, 1, 1, 1), + new Stat(new Magic(), 1, 1, 1, 1), + new Stat(new Ranged(), 1, 1, 1, 1), + new Stat(new Defence(), 1, 1, 1, 1), + new Stat(new Constitution(), 10, 10, 1, 1), + new Stat(new Prayer(), 1, 1, 1, 1), + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 99, 99, 1, 1) + ); + + $this->assertSame(99, $combat); + } + + /** @test */ + public function it_calculates_the_combat_level_with_one_hundred_twenty_necromancy(): void + { + $combat = combat_level( + new Stat(new Attack(), 1, 1, 1, 1), + new Stat(new Strength(), 1, 1, 1, 1), + new Stat(new Magic(), 1, 1, 1, 1), + new Stat(new Ranged(), 1, 1, 1, 1), + new Stat(new Defence(), 1, 1, 1, 1), + new Stat(new Constitution(), 10, 10, 1, 1), + new Stat(new Prayer(), 1, 1, 1, 1), + new Stat(new Summoning(), 1, 1, 1, 1), + new Stat(new Necromancy(), 120, 120, 1, 1) + ); + + $this->assertSame(78, $combat); + } } From bf5b747c2f191d5cfb3096d7eb5999f200a53b1d Mon Sep 17 00:00:00 2001 From: samfrjn11 Date: Wed, 9 Aug 2023 23:29:36 +0200 Subject: [PATCH 3/4] Update Profile.php Update for Necromancy combat formula --- src/RS3/Profile.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/RS3/Profile.php b/src/RS3/Profile.php index b80ba44..6260f6c 100644 --- a/src/RS3/Profile.php +++ b/src/RS3/Profile.php @@ -14,6 +14,7 @@ use RuneStat\RS3\Skills\Ranged; use RuneStat\RS3\Skills\Summoning; use RuneStat\RS3\Skills\Constitution; +use RuneStat\RS3\Skills\Necromancy; class Profile { @@ -64,7 +65,8 @@ public function getCombatLevel(): int $this->stats->findByClass(Defence::class), $this->stats->findByClass(Constitution::class), $this->stats->findByClass(Prayer::class), - $this->stats->findByClass(Summoning::class) + $this->stats->findByClass(Summoning::class), + $this->stats->findByClass(Necromancy::class) ); } } From b49a544c502fd265b0b88bee758808cd6fb0d00b Mon Sep 17 00:00:00 2001 From: samfrjn11 Date: Wed, 9 Aug 2023 23:34:39 +0200 Subject: [PATCH 4/4] Update CombatLevelTest.php --- tests/RS3/CombatLevelTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/RS3/CombatLevelTest.php b/tests/RS3/CombatLevelTest.php index 6e3810c..0dc4d5f 100644 --- a/tests/RS3/CombatLevelTest.php +++ b/tests/RS3/CombatLevelTest.php @@ -215,7 +215,7 @@ public function it_calculates_the_combat_level_with_ninety_nine_necromancy(): vo new Stat(new Necromancy(), 99, 99, 1, 1) ); - $this->assertSame(99, $combat); + $this->assertSame(67, $combat); } /** @test */ @@ -233,6 +233,6 @@ public function it_calculates_the_combat_level_with_one_hundred_twenty_necromanc new Stat(new Necromancy(), 120, 120, 1, 1) ); - $this->assertSame(78, $combat); + $this->assertSame(80, $combat); } }