Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Chris-plus-alphanumericgibberish/03443795d8f102db14667d4f465db9e6 to your computer and use it in GitHub Desktop.
Save Chris-plus-alphanumericgibberish/03443795d8f102db14667d4f465db9e6 to your computer and use it in GitHub Desktop.
/* general damage bonus */
if(real_attack){
/* The player has by-far the most detailed attacks */
if (youagr && (valid_weapon_attack || fake_valid_weapon_attack || unarmed_punch || unarmed_kick || natural_strike)) {
int bon_damage = 0;
bon_damage += u.udaminc;
bon_damage += aeshbon();
/* If you throw using a propellor, you don't get a strength
* bonus but you do get an increase-damage bonus.
*/
if(natural_strike)
bon_damage += dbon((struct obj *)0);
else if (!thrown)
bon_damage += dbon(weapon);
else{ //thrown
if (!fired)
bon_damage += dbon(weapon); // thrown by hand, get strength bonus
else if (launcher && objects[launcher->otyp].oc_skill == P_SLING)
bon_damage += dbon(launcher); // fired by a sling, get strength bonus
else if (launcher && launcher->otyp == ATLATL)
bon_damage += dbon(launcher) * 2; // fired by an atlatl, get 2x strength bonus
//else no bonus
}
bonsdmg += bon_damage;
} else if(!youagr){
int bon_damage = 0;
/*
* Monster's don't actually have anything other than a str bonus, and then only from items.
*/
if (!thrown)
bon_damage += m_dbon(magr, weapon);
else{ //thrown
if (!fired)
bon_damage += m_dbon(magr, weapon); // thrown by hand, get strength bonus
else if (launcher && objects[launcher->otyp].oc_skill == P_SLING)
bon_damage += m_dbon(magr, launcher); // fired by a sling, get strength bonus
else if (launcher && launcher->otyp == ATLATL)
bon_damage += m_dbon(magr, launcher) * 2; // fired by an atlatl, get 2x strength bonus
//else no bonus
}
bonsdmg += bon_damage;
}
}
int
m_dbon(mon, otmp) /* damage bonus for a monster's strength, only checks GoP */
struct monst *mon;
struct obj *otmp;
{
int bonus = 0;
struct obj *arm;
struct obj *arms;
struct obj *mwp;
struct obj *mswp;
arm = which_armor(mon, W_ARMG);
arms = which_armor(mon, W_ARMS);
mwp = MON_WEP(mon);
mswp = MON_SWEP(mon);
if(arm && arm->otyp == GAUNTLETS_OF_POWER)
bonus += 8;
if(otmp){
if((bimanual(otmp,mon->data)||
(otmp->oartifact==ART_PEN_OF_THE_VOID && otmp->ovar1&SEAL_MARIONETTE && mvitals[PM_ACERERAK].died > 0)
) && !arms && !mswp
) bonus *= 2;
else if(otmp->otyp == FORCE_SWORD && !arms && !mswp)
bonus *= 2;
else if(otmp->otyp == KATANA && !arms && !mswp)
bonus *= 1.5;
else if(is_vibrosword(otmp) && !arms && !mswp)
bonus *= 1.5;
if(otmp==mwp
&& (is_rapier(otmp)
|| (otmp->otyp == LIGHTSABER && otmp->oartifact != ART_ANNULUS && otmp->ovar1 == 0)
|| otmp->oartifact == ART_LIFEHUNT_SCYTHE
|| otmp->oartifact == ART_FRIEDE_S_SCYTHE
)){
if(is_rakuyo(otmp))
bonus = 0;
else bonus /= 2; /*Half strength bonus/penalty*/
if(arm && arm->oartifact == ART_PREMIUM_HEART) bonus += 8;
else if(arm && arm->otyp == GAUNTLETS_OF_DEXTERITY) bonus += arm->spe;
// else bonus += ; Something with dex ac? That would be a bad idea.
if(is_rakuyo(otmp))
bonus *= 2;
}
}
return bonus;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment