mirror of
https://codeberg.org/noisytoot/notnotdnethack.git
synced 2025-07-30 01:12:25 +01:00
Implement a new flamethrower implementation that is 100000x less hacky than the ndnh1 implementation.
This commit is contained in:
parent
5a0359ef15
commit
7a50d85aaa
6 changed files with 71 additions and 0 deletions
|
@ -12,6 +12,7 @@ struct zapdata {
|
|||
#define ZAP_SPELL 2
|
||||
#define ZAP_BREATH 3
|
||||
#define ZAP_RAYGUN 4
|
||||
#define ZAP_FLAMETHROWER 5
|
||||
int damn; /* number of dice */
|
||||
int damd; /* size of dice */
|
||||
int flat; /* alternative to damn and damd -- flat damage to deal */
|
||||
|
|
|
@ -181,6 +181,57 @@ int shots, shotlimit;
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
zap_flamethrower(obj, shots, shotlimit)
|
||||
struct obj *obj;
|
||||
int shots, shotlimit;
|
||||
{
|
||||
int cost = 1;
|
||||
|
||||
if(obj->ovar1 < cost){
|
||||
shots = 0;
|
||||
}
|
||||
|
||||
if(shots <= 0){
|
||||
You("pull the trigger, but nothing happens.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!u.dx && !u.dy){
|
||||
if(u.dz > 0){
|
||||
obj->ovar1 -= cost;
|
||||
if(!Blind)
|
||||
pline("The bugs on the %s burn to a crisp!", surface(u.ux, u.uy));
|
||||
else You("smell burnt bugs.");
|
||||
return 1;
|
||||
} else {
|
||||
obj->ovar1 -= cost;
|
||||
struct zapdata zapdata = { 0 };
|
||||
basiczap(&zapdata, AD_FIRE, ZAP_FLAMETHROWER, shots+1);
|
||||
zapdata.splashing = TRUE;
|
||||
zapdata.unreflectable = ZAP_REFL_NEVER;
|
||||
zapdata.no_bounce = TRUE;
|
||||
zapdata.directly_hits = FALSE;
|
||||
zap(&youmonst, u.ux, u.uy, u.dx, u.dy, 1, &zapdata);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
obj->ovar1 -= cost;
|
||||
|
||||
struct zapdata zapdata = { 0 };
|
||||
basiczap(&zapdata, AD_FIRE, ZAP_FLAMETHROWER, shots+1);
|
||||
zapdata.splashing = TRUE;
|
||||
zapdata.unreflectable = ZAP_REFL_NEVER;
|
||||
zapdata.no_bounce = TRUE;
|
||||
zapdata.directly_hits = FALSE;
|
||||
zap(&youmonst, u.ux, u.uy, u.dx, u.dy, 1, &zapdata);
|
||||
zap(&youmonst, u.ux, u.uy, u.dx, u.dy, 3, &zapdata);
|
||||
zap(&youmonst, u.ux, u.uy, u.dx, u.dy, 5, &zapdata);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* KMH -- Automatically fill quiver */
|
||||
/* Suggested by Jeffrey Bay <jbay@convex.hp.com> */
|
||||
void
|
||||
|
|
|
@ -556,6 +556,7 @@ GUN(("hand blaster", "hard black handmirror", "hard handmirror"), 0, MZ_MEDIUM,
|
|||
GUN(("arm blaster", "hard white bracer", "hard bracer"), 0, MZ_LARGE, 0, 8, 4500, 15, 6, 0,WP_BLASTER, PLASTIC, P_FIREARM, CLR_WHITE), /*Needs tile*/
|
||||
GUN(("mass-shadow pistol", "rectangular device"), 0, MZ_MEDIUM, 0, 4, 4500, 10, 1, 0,WP_BLASTER, PLASTIC, P_FIREARM, CLR_GRAY), /*Needs tile*/
|
||||
GUN(("cutting laser","hard tan lozenge", "hard lozenge"), 0, MZ_SMALL, 0, 1, 1000, 3, -1, 3,WP_BLASTER, PLASTIC, P_FIREARM, CLR_YELLOW), /*Needs tile*/
|
||||
GUN(("flamethrower","tank with long tube"), 0, MZ_MEDIUM, 0, 45, 3000, 15, 1, 0, WP_BLASTER, METAL, P_FIREARM, CLR_ORANGE), /*Needs tile*/
|
||||
|
||||
GUN(("raygun", "hard handle ending in glassy disks"), 0, MZ_MEDIUM, 0, 8, 3000, 15, 1, 0,WP_BLASTER, PLASTIC, P_FIREARM, CLR_BRIGHT_CYAN), /*Needs tile*/
|
||||
BULLET(("bullet", "pellet"),
|
||||
|
|
|
@ -2121,6 +2121,15 @@ dofire()
|
|||
obfree(ammo, 0);
|
||||
ammo = (struct obj *)0;
|
||||
break;
|
||||
case FLAMETHROWER:
|
||||
/* create fake ammo in order to calculate multishot correctly */
|
||||
ammo = blaster_ammo(launcher);
|
||||
if (getdir((char *)0))
|
||||
result += zap_flamethrower(launcher, calc_multishot(&youmonst, ammo, launcher, shotlimit), shotlimit);
|
||||
/* destroy ammo and don't go through uthrow */
|
||||
obfree(ammo, 0);
|
||||
ammo = (struct obj *)0;
|
||||
break;
|
||||
default:
|
||||
impossible("Unhandled blaster %d!", launcher->otyp);
|
||||
break;
|
||||
|
@ -2367,6 +2376,7 @@ struct obj * blaster;
|
|||
ammo = mksobj(ROCK, MKOBJ_NOINIT); /* should not happen */
|
||||
break;
|
||||
case RAYGUN:
|
||||
case FLAMETHROWER:
|
||||
/* create fake ammo in order to calculate multishot correctly */
|
||||
ammo = mksobj(LASER_BEAM, MKOBJ_NOINIT);
|
||||
break;
|
||||
|
@ -3341,6 +3351,7 @@ int tary;
|
|||
/* no special changes required */
|
||||
break;
|
||||
case RAYGUN:
|
||||
case FLAMETHROWER:
|
||||
// TODO: monster raygun function
|
||||
//if (!getdir((char *)0))
|
||||
// result |= zap_raygun(launcher, calc_multishot(&youmonst, ammo, launcher, shotlimit), shotlimit);
|
||||
|
|
|
@ -1179,6 +1179,7 @@ int curse_bless;
|
|||
case FORCE_SWORD:
|
||||
case FORCE_WHIP:
|
||||
case SEISMIC_HAMMER:
|
||||
case FLAMETHROWER:
|
||||
if(is_blessed) obj->ovar1 = 100L;
|
||||
else if(is_cursed) obj->ovar1 = 10L;
|
||||
else obj->ovar1 = 80L + rn2(20);
|
||||
|
|
|
@ -137,6 +137,12 @@ int adtyp, ztyp;
|
|||
default: impossible("unknown raygun damage type in flash_type: %d", adtyp);
|
||||
return "barrage of lost packets";
|
||||
}
|
||||
case ZAP_FLAMETHROWER:
|
||||
switch(adtyp){
|
||||
case AD_FIRE: return "stream of burning oil";
|
||||
default: impossible("unknown flamethrower damage type in flash_type: %d", adtyp);
|
||||
return "stream of bad gas prices";
|
||||
}
|
||||
default:
|
||||
impossible("unknown ztyp in flash_type: %d", ztyp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue