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

Modifications for generalized "when hit" monster actions. #6124

Merged
merged 3 commits into from Feb 19, 2014

Conversation

Projects
None yet
3 participants
@ClockworkZombie
Copy link

commented Feb 16, 2014

Submitting again, hopefully for real this time.

Other PRs of mine that this or something very similar to this has been posted under: #5943, #5965, #5974 (all closed).

Ported and buffed the current scheme for damage on hit from shock zombies and shadows to a new framework for triggering things that happen when something is hit. The longer-term idea is to make combat a bit more dynamic and strategic by incentivizing/penalizing different types of attacks beyond basic damage type resistance/weakness and armour piercing. This will also hopefully help keep the monster-specific stuff out of the generic attack/damage routines.

This is roughly analogous to the current sp_attack system. As with that system, the "defense" moves don't really need to be beneficial to the monster, it's just a way to have specific things happen when the monster gets hit. As per earlier feedback, the current zapback member has no move cost because the old shock didn't. If/when other stuff is added, some of those on-hit moves may merit a cost but that will be up to whomever adds them, the intention is not to give monsters a bunch of free attacks.

As for the zapback buff, this is intended to make the penalty from striking a shock zombie worth noticing. a 50% chance of 1 damage that can be blocked by wearing gloves is pretty weaksauce.

Looking for feedback, as this might also belong under on_gethit, but it doesn't look like that's been implemented for monsters yet. I'd be happy to add a few more things to build on (quill attacks, spores, disarming, etc.) but figured some input would be good before ploughing forward.

Thanks all!

@@ -1817,8 +1817,10 @@
"luminance":1,
"hp":75,
"special_freq":25,
"special_when_hit_freq":100,

This comment has been minimized.

Copy link
@kevingranade

kevingranade Feb 16, 2014

Member

Looks like your text editor is inserting tabs, we only use spaces for indention.

This comment has been minimized.

Copy link
@KA101

KA101 Feb 17, 2014

Contributor

In Notepad++, there's a setting>Preferences>Tab option. Set it to 2 and "replace with space" so hitting Tab inserts a pair of spaces, rather than a Tab character. (Different programs interpret Tab differently. No idea why.) That way you can still hit Tab twice to indent properly.

void mdefense::zapback(monster *m)
{
int j;
if (rl_dist(m->posx(), m->posy(), g->u.posx, g->u.posy) > 1 || !g->sees_u(m->posx(), m->posy(), j))

This comment has been minimized.

Copy link
@kevingranade

kevingranade Feb 16, 2014

Member

probably more tabs here, and generally you need to split lines this long, like:
if (rl_dist(m->posx(), m->posy(), g->u.posx, g->u.posy) > 1 ||
!g->sees_u(m->posx(), m->posy(), j)) {
Note the '{', they're mandatory for all conditional and looping statements, even if the body is one line.
Generally speaking, new code needs to use 4 spaces per level of indention.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Feb 16, 2014

Looks good overall, my only issue with it is the indention is kind of all over the place.

ClockworkZombie

@KA101 KA101 self-assigned this Feb 18, 2014

@KA101

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2014

takes control of a large rubber crane
Clear!
grabs shocker zombie, maneuvers it over the PR

{
return; // Out of range
}
if ((g->u.weapon.conductive() || g->u.unarmed_attack()) && (rng(0,100) <= m->def_chance));

This comment has been minimized.

Copy link
@KA101

KA101 Feb 18, 2014

Contributor

C::B warning: got an empty-body issue. (I'd just throw parens around the rng and m->def variables it it was my PR.)

Apart from that and needing to put this in the code::Blocks project file, it's recoverable.

ClockworkZombie
{
return; // Out of range
}
if ((g->u.weapon.conductive() || g->u.unarmed_attack()) && (rng(0,100) <= m->def_chance))

This comment has been minimized.

Copy link
@KA101

KA101 Feb 19, 2014

Contributor

FWIW I got this when whacking the shocker with my Baseball Player's all-wood bat.

Methinks there's a problem with the conductivity-checking. Will merge anyway, can fix that later.

@KA101 KA101 referenced this pull request Feb 19, 2014

Closed

Conductivity-check #6190

@KA101 KA101 merged commit 4fadd55 into CleverRaven:master Feb 19, 2014

1 check failed

default Unmergeable pull request.

@ClockworkZombie ClockworkZombie deleted the ClockworkZombie:mon_on_hit branch Feb 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.