- getRecoilChance + getDodgeChance

This commit is contained in:
Christoph Oelckers 2021-05-06 09:08:06 +02:00
parent b70368050a
commit b1f55434a2
3 changed files with 12 additions and 10 deletions

View file

@ -1097,7 +1097,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
{
if (!dudeIsMelee(actor))
{
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite)))
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(actor)))
{
if (!spriteIsUnderwater(actor))
{
@ -1274,7 +1274,7 @@ void RecoilDude(DBloodActor* actor)
case kDudeModernCustom:
{
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
int rChance = getRecoilChance(pSprite);
int rChance = getRecoilChance(actor);
if (pExtra->canElectrocute && pDudeExtra->teslaHit && !spriteIsUnderwater(actor, false))
{
if (Chance(rChance << 3) || (dudeIsMelee(actor) && Chance(rChance << 4))) aiGenDudeNewState(actor, &genDudeRecoilTesla);

View file

@ -1808,9 +1808,10 @@ int getBaseChanceModifier(int baseChance)
return ((gGameOptions.nDifficulty > 0) ? baseChance - (0x0500 * gGameOptions.nDifficulty) : baseChance);
}
int getRecoilChance(spritetype* pSprite) {
auto actor = &bloodActors[pSprite->index];
XSPRITE* pXSprite = &xsprite[pSprite->extra];
int getRecoilChance(DBloodActor* actor)
{
auto const pSprite = &actor->s();
auto const pXSprite = &actor->x();
int mass = getSpriteMassBySize(pSprite);
int baseChance = (!dudeIsMelee(actor) ? 0x8000 : 0x4000);
baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3;
@ -1819,9 +1820,10 @@ int getRecoilChance(spritetype* pSprite) {
return chance;
}
int getDodgeChance(spritetype* pSprite) {
auto actor = &bloodActors[pSprite->index];
XSPRITE* pXSprite = &xsprite[pSprite->extra];
int getDodgeChance(DBloodActor* actor)
{
auto const pSprite = &actor->s();
auto const pXSprite = &actor->x();
int mass = getSpriteMassBySize(pSprite);
int baseChance = (!dudeIsMelee(actor) ? 0x6000 : 0x1000);
baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3;

View file

@ -210,8 +210,8 @@ bool doExplosion(spritetype* pSprite, int nType);
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist);
void genDudeTransform(spritetype* pSprite);
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3);
int getDodgeChance(spritetype* pSprite);
int getRecoilChance(spritetype* pSprite);
int getDodgeChance(DBloodActor* pSprite);
int getRecoilChance(DBloodActor* pSprite);
bool dudeIsMelee(DBloodActor* pXSprite);
void updateTargetOfSlaves(spritetype* pSprite);
void updateTargetOfLeech(spritetype* pSprite);