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

Bug with big number of civil ships #42

Open
koraykarakus opened this issue Jan 12, 2022 · 3 comments
Open

Bug with big number of civil ships #42

koraykarakus opened this issue Jan 12, 2022 · 3 comments

Comments

@koraykarakus
Copy link

koraykarakus commented Jan 12, 2022

There is problem with big number of small cargo, heavy cargo, and recycler,
attacker :
small cargo : 7,000,000
battlecruiser : 40,000

defender:
small cargo : 2,700,000
battlecruiser : 15,000

after battle

attacker :
small cargo : 6440792
battlecruiser : 39857

defender:
small cargo : 2,700,000
battlecruiser : 15,000

result :
The battle ended in a draw
The attacker has lost a total of 2 246 842 000 units.
The defender has lost a total of 0 units.

problem : attacker has bigger number of ships, more battlecruisers but he cannot drop even 1 ship of defender.

test code used :
<?php require ("../../RunnableTest.php"); class MyTest extends RunnableTest { public function getAttachers() { $fleet = new Fleet(1,array( $this->getShipType(202, 7000000), $this->getShipType(215, 40000))); $player = new Player(1, array($fleet)); return new PlayerGroup(array($player)); } public function getDefenders() { $fleet = new Fleet(2,array( $this->getShipType(202, 2700000), $this->getShipType(215, 15000))); $player = new Player(2, array($fleet)); return new PlayerGroup(array($player)); } } new MyTest(); ?>

@noonn
Copy link

noonn commented Aug 10, 2023

I have the same problem.
If you know how to solve it, please tell me.

@noonn
Copy link

noonn commented Aug 13, 2023

I checked again.
It seems that the problem occurs regardless of the number of ships in battle.
It looks like you need a quick fix.
I need help from someone who can solve it.

@noonn
Copy link

noonn commented Aug 16, 2023

Please try a test.

combatObject/ShipsCleaner.php

==============
find line
if (USE_BIEXPLOSION_SYSTEM && $this->lastShipHit >= $this->fighters->getCount() / PROB_TO_REAL_MAGIC)
{
log_comment('lastShipHit bigger than getCount()/magic');
if ($prob < MIN_PROB_TO_EXPLODE)
{
$probToExplode = 0;
}
else
{
$probToExplode = $prob;
}
}
//otherwise statistically:
else
{
log_comment('lastShipHit smaller than getCount()/magic');
$probToExplode = $prob * (1 - MIN_PROB_TO_EXPLODE);
}

Modify as below

if ($prob < MIN_PROB_TO_EXPLODE)
{
log_comment('lastShipHit smaller than getCount()/magic');
$probToExplode = $prob * (1 - MIN_PROB_TO_EXPLODE);
}
else
{
log_comment('lastShipHit smaller than getCount()/magic');
$probToExplode = $prob;
}

==================

Please let me know if you have better code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants