本文整理汇总了C++中monster类的典型用法代码示例。如果您正苦于以下问题:C++ monster类的具体用法?C++ monster怎么用?C++ monster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了monster类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: draw_hit_mon
/* Monster hit animation */
void game::draw_hit_mon(int x, int y, monster m, bool dead)
{
if (use_tiles) {
//int iTimeout = 0;
tilecontext->init_draw_hit(x, y, m.type->id);
wrefresh(w_terrain);
try_update();
timespec tspec;
tspec.tv_sec = 0;
tspec.tv_nsec = 1000000 * OPTIONS["ANIMATION_DELAY"];
if( tspec.tv_nsec != 0 ) {
nanosleep(&tspec, NULL);
}
} else {
nc_color cMonColor = m.type->color;
const std::string &sMonSym = m.symbol();
hit_animation(POSX + (x - (u.posx + u.view_offset_x)),
POSY + (y - (u.posy + u.view_offset_y)),
red_background(cMonColor), dead ? "%" : sMonSym);
}
}
开发者ID:Chase-san,项目名称:Cataclysm-DDA,代码行数:25,代码来源:animation_tiles.cpp
示例2: select
virtual void select(int entnum, uimenu *menu) {
if ( ! started ) {
started = true;
setup(menu);
}
if (entnum != lastent) {
lastent = entnum;
tmp = monster(GetMType(entnum));
if (friendly) {
tmp.friendly = -1;
}
}
werase(w_info);
tmp.print_info(w_info);
std::string header = string_format("#%d: %s", entnum, GetMType(entnum)->nname().c_str());
mvwprintz(w_info, 1, ( getmaxx(w_info) - header.size() ) / 2, c_cyan, "%s",
header.c_str());
mvwprintz(w_info, getmaxy(w_info) - 3, 0, c_green, "%s", msg.c_str());
msg = padding;
mvwprintw(w_info, getmaxy(w_info) - 2, 0, _("[/] find, [f] friendly, [q]uit"));
}
开发者ID:Chase-san,项目名称:Cataclysm-DDA,代码行数:24,代码来源:wish.cpp
示例3: zapback
void mdefense::zapback( monster &m, Creature *const source,
dealt_projectile_attack const * )
{
if( source == nullptr ) {
return;
}
player const *const foe = dynamic_cast<player *>( source );
// Players/NPCs can avoid the shock by using non-conductive weapons
if( foe != nullptr && foe->is_armed() && !foe->weapon.conductive() ) {
return;
}
// Ranged weapons get no zapback, unless they have an active MELEE mode.
if( foe != nullptr && foe->weapon.is_gun() && !foe->weapon.gun_current_mode().melee() ) {
return;
}
if( source->is_elec_immune() ) {
return;
}
if( g->u.sees( source->pos() ) ) {
auto const msg_type = ( source == &g->u ) ? m_bad : m_info;
add_msg( msg_type, _( "Striking the %1$s shocks %2$s!" ),
m.name().c_str(), source->disp_name().c_str() );
}
damage_instance const shock {
DT_ELECTRIC, static_cast<float>( rng( 1, 5 ) )
};
source->deal_damage( &m, bp_arm_l, shock );
source->deal_damage( &m, bp_arm_r, shock );
source->check_dead_state();
}
开发者ID:ProfoundDarkness,项目名称:Cataclysm-DDA,代码行数:36,代码来源:mondefense.cpp
示例4: kill_vines
void mdeath::kill_vines( monster &z )
{
const std::vector<Creature *> vines = g->get_creatures_if( [&]( const Creature & critter ) {
const monster *const mon = dynamic_cast<const monster *>( &critter );
return mon && mon->type->id == mon_creeper_vine;
} );
const std::vector<Creature *> hubs = g->get_creatures_if( [&]( const Creature & critter ) {
const monster *const mon = dynamic_cast<const monster *>( &critter );
return mon && mon != &z && mon->type->id == mon_creeper_hub;
} );
for( Creature *const vine : vines ) {
int dist = rl_dist( vine->pos(), z.pos() );
bool closer = false;
for( auto &j : hubs ) {
if( rl_dist( vine->pos(), j->pos() ) < dist ) {
break;
}
}
if( !closer ) { // TODO: closer variable is not being updated and is always false!
vine->die( &z );
}
}
}
开发者ID:Reclusive-reptile,项目名称:Cataclysm-DDA,代码行数:24,代码来源:mondeath.cpp
示例5: preg_roach
void mdeath::preg_roach( monster &z )
{
int num_roach = rng( 1, 3 );
std::vector <tripoint> roachspots;
for( const auto &roachp : g->m.points_in_radius( z.pos(), 1 ) ) {
if( g->is_empty( roachp ) ) {
roachspots.push_back( roachp );
}
}
while( !roachspots.empty() ) {
const tripoint target = random_entry_removed( roachspots );
if( !g->critter_at( target ) ) {
g->summon_mon( mon_giant_cockroach_nymph, target );
num_roach--;
if( g->u.sees( z ) ) {
add_msg( m_warning, _( "A cockroach nymph crawls out of the pregnant giant cockroach corpse." ) );
}
}
if( num_roach == 0 ) {
break;
}
}
}
开发者ID:Reclusive-reptile,项目名称:Cataclysm-DDA,代码行数:24,代码来源:mondeath.cpp
示例6: normal
void mdeath::normal( monster &z )
{
if( z.no_corpse_quiet ) {
return;
}
if( z.type->in_species( ZOMBIE ) ) {
sfx::play_variant_sound( "mon_death", "zombie_death", sfx::get_heard_volume( z.pos() ) );
}
if( g->u.sees( z ) ) {
//Currently it is possible to get multiple messages that a monster died.
add_msg( m_good, _( "The %s dies!" ), z.name() );
}
const int max_hp = std::max( z.get_hp_max(), 1 );
const float overflow_damage = std::max( -z.get_hp(), 0 );
const float corpse_damage = 2.5 * overflow_damage / max_hp;
const bool pulverized = corpse_damage > 5 && overflow_damage > z.get_hp_max();
z.bleed(); // leave some blood if we have to
if( !pulverized ) {
make_mon_corpse( z, static_cast<int>( std::floor( corpse_damage * itype::damage_scale ) ) );
}
// if mdeath::splatter was set along normal makes sure it is not called twice
bool splatt = false;
for( const auto &deathfunction : z.type->dies ) {
if( deathfunction == mdeath::splatter ) {
splatt = true;
}
}
if( !splatt ) {
splatter( z );
}
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:36,代码来源:mondeath.cpp
示例7: gameover
void mdeath::gameover( monster &z )
{
add_msg( m_bad, _( "The %s was destroyed! GAME OVER!" ), z.name() );
g->u.hp_cur[hp_torso] = 0;
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:5,代码来源:mondeath.cpp
示例8: thing
void mdeath::thing( monster &z )
{
g->summon_mon( mon_thing, z.pos() );
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:4,代码来源:mondeath.cpp
示例9: smokeburst
void mdeath::smokeburst( monster &z )
{
std::string explode = string_format( _( "a %s explode!" ), z.name() );
sounds::sound( z.pos(), 24, sounds::sound_t::combat, explode, false, "explosion", "small" );
g->m.emit_field( z.pos(), emit_id( "emit_smoke_blast" ) );
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:6,代码来源:mondeath.cpp
示例10: _
void mdeath::guilt( monster &z )
{
const int MAX_GUILT_DISTANCE = 5;
int kill_count = g->kill_count( z.type->id );
int maxKills = 100; // this is when the player stop caring altogether.
// different message as we kill more of the same monster
std::string msg = _( "You feel guilty for killing %s." ); // default guilt message
game_message_type msgtype = m_bad; // default guilt message type
std::map<int, std::string> guilt_tresholds;
guilt_tresholds[75] = _( "You feel ashamed for killing %s." );
guilt_tresholds[50] = _( "You regret killing %s." );
guilt_tresholds[25] = _( "You feel remorse for killing %s." );
if( g->u.has_trait( trait_PSYCHOPATH ) || g->u.has_trait( trait_PRED3 ) ||
g->u.has_trait( trait_PRED4 ) ) {
return;
}
if( rl_dist( z.pos(), g->u.pos() ) > MAX_GUILT_DISTANCE ) {
// Too far away, we can deal with it.
return;
}
if( z.get_hp() >= 0 ) {
// We probably didn't kill it
return;
}
if( kill_count >= maxKills ) {
// player no longer cares
if( kill_count == maxKills ) {
//~ Message after killing a lot of monsters which would normally affect the morale negatively. %s is the monster name, it will be pluralized with a number of 100.
add_msg( m_good, _( "After killing so many bloody %s you no longer care "
"about their deaths anymore." ), z.name( maxKills ) );
}
return;
} else if( ( g->u.has_trait( trait_PRED1 ) ) || ( g->u.has_trait( trait_PRED2 ) ) ) {
msg = ( _( "Culling the weak is distasteful, but necessary." ) );
msgtype = m_neutral;
} else {
msgtype = m_bad;
for( auto &guilt_treshold : guilt_tresholds ) {
if( kill_count >= guilt_treshold.first ) {
msg = guilt_treshold.second;
break;
}
}
}
add_msg( msgtype, msg, z.name() );
int moraleMalus = -50 * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
int maxMalus = -250 * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration duration = 30_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
time_duration decayDelay = 3_minutes * ( 1.0 - ( static_cast<float>( kill_count ) / maxKills ) );
if( z.type->in_species( ZOMBIE ) ) {
moraleMalus /= 10;
if( g->u.has_trait( trait_PACIFIST ) ) {
moraleMalus *= 5;
} else if( g->u.has_trait( trait_PRED1 ) ) {
moraleMalus /= 4;
} else if( g->u.has_trait( trait_PRED2 ) ) {
moraleMalus /= 5;
}
}
g->u.add_morale( MORALE_KILLED_MONSTER, moraleMalus, maxMalus, duration, decayDelay );
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:66,代码来源:mondeath.cpp
示例11: melt
void mdeath::melt( monster &z )
{
if( g->u.sees( z ) ) {
add_msg( m_good, _( "The %s melts away." ), z.name() );
}
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:6,代码来源:mondeath.cpp
示例12: material_id
void mdeath::splatter( monster &z )
{
// Limit chunking to flesh, veggy and insect creatures until other kinds are supported.
const std::vector<material_id> gib_mats = {{
material_id( "flesh" ), material_id( "hflesh" ),
material_id( "veggy" ), material_id( "iflesh" ),
material_id( "bone" )
}
};
const bool gibbable = !z.type->has_flag( MF_NOGIB ) &&
std::any_of( gib_mats.begin(), gib_mats.end(), [&z]( const material_id & gm ) {
return z.made_of( gm );
} );
const int max_hp = std::max( z.get_hp_max(), 1 );
const float overflow_damage = std::max( -z.get_hp(), 0 );
const float corpse_damage = 2.5 * overflow_damage / max_hp;
bool pulverized = corpse_damage > 5 && overflow_damage > z.get_hp_max();
// make sure that full splatter happens when this is a set death function, not part of normal
for( const auto &deathfunction : z.type->dies ) {
if( deathfunction == mdeath::splatter ) {
pulverized = true;
}
}
const field_id type_blood = z.bloodType();
const field_id type_gib = z.gibType();
if( gibbable ) {
const auto area = g->m.points_in_radius( z.pos(), 1 );
int number_of_gibs = std::min( std::floor( corpse_damage ) - 1, 1 + max_hp / 5.0f );
if( pulverized && z.type->size >= MS_MEDIUM ) {
number_of_gibs += rng( 1, 6 );
sfx::play_variant_sound( "mon_death", "zombie_gibbed", sfx::get_heard_volume( z.pos() ) );
}
for( int i = 0; i < number_of_gibs; ++i ) {
g->m.add_splatter( type_gib, random_entry( area ), rng( 1, i + 1 ) );
g->m.add_splatter( type_blood, random_entry( area ) );
}
}
int num_chunks = rng( 0, z.type->get_meat_chunks_count() / 4 );
num_chunks = std::min( num_chunks, 10 );
if( pulverized && gibbable ) {
const itype_id meat = z.type->get_meat_itype();
const item chunk( meat );
for( int i = 0; i < num_chunks; i++ ) {
bool drop_chunks = true;
tripoint tarp( z.pos() + point( rng( -3, 3 ), rng( -3, 3 ) ) );
const auto traj = line_to( z.pos(), tarp );
for( size_t j = 0; j < traj.size(); j++ ) {
tarp = traj[j];
if( one_in( 2 ) && type_blood != fd_null ) {
g->m.add_splatter( type_blood, tarp );
} else {
g->m.add_splatter( type_gib, tarp, rng( 1, j + 1 ) );
}
if( g->m.impassable( tarp ) ) {
g->m.bash( tarp, 3 );
if( g->m.impassable( tarp ) ) {
// Target is obstacle, not destroyed by bashing,
// stop trajectory in front of it, if this is the first
// point (e.g. wall adjacent to monster), don't drop anything on it
if( j > 0 ) {
tarp = traj[j - 1];
} else {
drop_chunks = false;
}
break;
}
}
}
if( drop_chunks ) {
g->m.add_item_or_charges( tarp, chunk );
}
}
}
}
开发者ID:OzoneH3,项目名称:Cataclysm-DDA,代码行数:83,代码来源:mondeath.cpp
示例13: disappear
void mdeath::disappear( monster &z )
{
if( g->u.sees( z ) ) {
add_msg( m_good, _( "The %s disappears." ), z.name() );
}
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:6,代码来源:mondeath.cpp
示例14: shoot_monster
void shoot_monster(game *g, player &p, monster &mon, int &dam, double goodhit, item* weapon)
{
// Gunmods don't have a type, so use the player weapon type.
it_gun* firing = dynamic_cast<it_gun*>(p.weapon.type);
std::string message;
bool u_see_mon = g->u_see(&(mon));
if (mon.has_flag(MF_HARDTOSHOOT) && !one_in(4) &&
weapon->curammo->phase != LIQUID &&
weapon->curammo->accuracy >= 4) { // Buckshot hits anyway
if (u_see_mon)
g->add_msg("The shot passes through the %s without hitting.",
mon.name().c_str());
goodhit = 1;
} else { // Not HARDTOSHOOT
// Armor blocks BEFORE any critical effects.
int zarm = mon.armor_cut();
zarm -= weapon->curammo->pierce;
if (weapon->curammo->phase == LIQUID)
zarm = 0;
else if (weapon->curammo->accuracy < 4) // Shot doesn't penetrate armor well
zarm *= rng(2, 4);
if (zarm > 0)
dam -= zarm;
if (dam <= 0) {
if (u_see_mon)
g->add_msg("The shot reflects off the %s!",
mon.name_with_armor().c_str());
dam = 0;
goodhit = 1;
}
if (goodhit < .1 && !mon.has_flag(MF_NOHEAD)) {
message = "Headshot!";
dam = rng(5 * dam, 8 * dam);
p.practice(g->turn, firing->skill_used, 5);
} else if (goodhit < .2) {
message = "Critical!";
dam = rng(dam * 2, dam * 3);
p.practice(g->turn, firing->skill_used, 2);
} else if (goodhit < .4) {
dam = rng(int(dam * .9), int(dam * 1.5));
p.practice(g->turn, firing->skill_used, rng(0, 2));
} else if (goodhit <= .7) {
message = "Grazing hit.";
dam = rng(0, dam);
} else
dam = 0;
// Find the zombie at (x, y) and hurt them, MAYBE kill them!
if (dam > 0) {
mon.moves -= dam * 5;
if (&p == &(g->u) && u_see_mon)
g->add_msg("%s You hit the %s for %d damage.", message.c_str(), mon.name().c_str(), dam);
else if (u_see_mon)
g->add_msg("%s %s shoots the %s.", message.c_str(), p.name.c_str(), mon.name().c_str());
bool bMonDead = mon.hurt(dam);
hit_animation(mon.posx - g->u.posx + VIEWX - g->u.view_offset_x,
mon.posy - g->u.posy + VIEWY - g->u.view_offset_y,
red_background(mon.type->color), (bMonDead) ? '%' : mon.symbol());
if (bMonDead)
g->kill_mon(g->mon_at(mon.posx, mon.posy), (&p == &(g->u)));
else if (weapon->curammo->ammo_effects != 0)
g->hit_monster_with_flags(mon, weapon->curammo->ammo_effects);
dam = 0;
}
}
}
开发者ID:joneskun,项目名称:Cataclysm-DDA,代码行数:68,代码来源:ranged.cpp
示例15: debugmsg
void gun_actor::shoot( monster &z, Creature &target ) const
{
// Make sure our ammo isn't weird.
if( z.ammo[ammo_type] > max_ammo ) {
debugmsg( "Generated too much ammo (%d) of type %s for %s in gun_actor::shoot",
z.ammo[ammo_type], ammo_type.c_str(), z.name().c_str() );
z.ammo[ammo_type] = max_ammo;
}
const bool require_targeting = ( require_targeting_player && target.is_player() ) ||
( require_targeting_npc && target.is_npc() ) ||
( require_targeting_monster && target.is_monster() );
const bool not_targeted = require_targeting && !z.has_effect( effect_targeted );
const bool not_laser_locked = require_targeting && laser_lock &&
!target.has_effect( effect_was_laserlocked );
if( not_targeted || not_laser_locked ) {
if( !targeting_sound.empty() ) {
sounds::sound( z.pos(), targeting_volume, _( targeting_sound.c_str() ) );
}
if( not_targeted ) {
z.add_effect( effect_targeted, targeting_timeout );
}
if( not_laser_locked ) {
target.add_effect( effect_laserlocked, 5 );
target.add_effect( effect_was_laserlocked, 5 );
target.add_msg_if_player( m_warning,
_( "You're not sure why you've got a laser dot on you..." ) );
}
z.moves -= targeting_cost;
return;
}
// It takes a while
z.moves -= move_cost;
if( z.ammo[ammo_type] <= 0 && !no_ammo_sound.empty() ) {
sounds::sound( z.pos(), 10, _( no_ammo_sound.c_str() ) );
return;
}
if( g->u.sees( z ) ) {
add_msg( m_warning, _( description.c_str() ) );
}
npc tmp;
tmp.name = _( "The " ) + z.name();
tmp.set_fake( true );
tmp.recoil = 0;
tmp.driving_recoil = 0;
tmp.setpos( z.pos() );
tmp.str_max = fake_str;
tmp.dex_max = fake_dex;
tmp.int_max = fake_int;
tmp.per_max = fake_per;
tmp.str_cur = fake_str;
tmp.dex_cur = fake_dex;
tmp.int_cur = fake_int;
tmp.per_cur = fake_per;
tmp.weapon = item( gun_type, 0 );
tmp.weapon.set_curammo( ammo_type );
tmp.weapon.charges = z.ammo[ammo_type];
if( z.friendly != 0 ) {
tmp.attitude = NPCATT_DEFEND;
} else {
tmp.attitude = NPCATT_KILL;
}
for( const auto &pr : fake_skills ) {
tmp.skillLevel( pr.first ).level( pr.second );
}
const auto distance = rl_dist( z.pos(), target.pos() );
int burst_size = std::min( burst_limit, tmp.weapon.burst_size() );
if( distance > range_no_burst || burst_size < 1 ) {
burst_size = 1;
}
tmp.fire_gun( target.pos(), burst_size );
z.ammo[ammo_type] = tmp.weapon.charges;
if( require_targeting ) {
z.add_effect( effect_targeted, targeting_timeout_extend );
}
if( laser_lock ) {
// To prevent spamming laser locks when the player can tank that stuff somehow
target.add_effect( effect_was_laserlocked, 5 );
}
}
开发者ID:Maeyanie,项目名称:Cataclysm-DDA,代码行数:90,代码来源:mattack_actors.cpp
示例16: if
void mdeath::detonate( monster &z )
{
weighted_int_list<std::string> amm_list;
for( const auto &amm : z.ammo ) {
amm_list.add( amm.first, amm.second );
}
std::vector<std::string> pre_dets;
for( int i = 0; i < 3; i++ ) {
if( amm_list.get_weight() <= 0 ) {
break;
}
// Grab one item
std::string tmp = *amm_list.pick();
// and reduce its weight by 1
amm_list.add_or_replace( tmp, amm_list.get_specific_weight( tmp ) - 1 );
// and stash it for use
pre_dets.push_back( tmp );
}
// Update any hardcoded explosion equivalencies
std::vector<std::pair<std::string, long>> dets;
for( const std::string &bomb_id : pre_dets ) {
if( bomb_id == "bot_grenade_hack" ) {
dets.push_back( std::make_pair( "grenade_act", 5 ) );
} else if( bomb_id == "bot_flashbang_hack" ) {
dets.push_back( std::make_pair( "flashbang_act", 5 ) );
} else if( bomb_id == "bot_gasbomb_hack" ) {
dets.push_back( std::make_pair( "gasbomb_act", 20 ) );
} else if( bomb_id == "bot_c4_hack" ) {
dets.push_back( std::make_pair( "c4armed", 10 ) );
} else if( bomb_id == "bot_mininuke_hack" ) {
dets.push_back( std::make_pair( "mininuke_act", 20 ) );
} else {
// Get the transformation item
const iuse_transform *actor = dynamic_cast<const iuse_transform *>(
item::find_type( bomb_id )->get_use( "transform" )->get_actor_ptr() );
if( actor == nullptr ) {
// Invalid bomb item, move to the next ammo item
add_msg( m_debug, "Invalid bomb type in detonate mondeath for %s.", z.name() );
continue;
}
dets.emplace_back( actor->target, actor->ammo_qty );
}
}
if( g->u.sees( z ) ) {
if( dets.empty() ) {
//~ %s is the possessive form of the monster's name
add_msg( m_info,
_( "The %s's hands fly to its pockets, but there's nothing left in them." ),
z.name() );
} else {
//~ %s is the possessive form of the monster's name
add_msg( m_bad, _( "The %s's hands fly to its remaining pockets, opening them!" ),
z.name() );
}
}
// HACK, used to stop them from having ammo on respawn
z.add_effect( effect_no_ammo, 1_turns, num_bp, true );
// First die normally
mdeath::normal( z );
// Then detonate our suicide bombs
for( const auto &bombs : dets ) {
item bomb_item( bombs.first, 0 );
bomb_item.charges = bombs.second;
bomb_item.active = true;
g->m.add_item_or_charges( z.pos(), bomb_item );
}
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:71,代码来源:mondeath.cpp
示例17: dead_mon_at
bool Creature_tracker::update_pos(const monster &critter, const int new_x_pos, const int new_y_pos)
{
if (critter.posx() == new_x_pos && critter.posy() == new_y_pos) {
return true; // success?
}
bool success = false;
const int dead_critter_id = dead_mon_at(point(critter.posx(), critter.posy()));
const int live_critter_id = mon_at(point(critter.posx(), critter.posy()));
const int critter_id = critter.dead ? dead_critter_id : live_critter_id;
const int new_critter_id = mon_at(new_x_pos, new_y_pos);
if (new_critter_id >= 0 && !_old_monsters_list[new_critter_id]->dead) {
debugmsg("update_zombie_pos: new location %d,%d already has zombie %d",
new_x_pos, new_y_pos, new_critter_id);
} else if (critter_id >= 0) {
if (&critter == _old_monsters_list[critter_id]) {
_old_monsters_by_location.erase(point(critter.posx(), critter.posy()));
_old_monsters_by_location[point(new_x_pos, new_y_pos)] = critter_id;
success = true;
} else {
debugmsg("update_zombie_pos: old location %d,%d had zombie %d instead",
critter.posx(), critter.posy(), critter_id);
}
} else {
// We're changing the x/y coordinates of a zombie that hasn't been added
// to the game yet. add_zombie() will update _old_monsters_by_location for us.
debugmsg("update_zombie_pos: no such zombie at %d,%d (moving to %d,%d)",
critter.posx(), critter.posy(), new_x_pos, new_y_pos);
}
return success;
}
开发者ID:Chase-san,项目名称:Cataclysm-DDA,代码行数:30,代码来源:creature_tracker.cpp
示例18: gas
void mdeath::gas( monster &z )
{
std::string explode = string_format( _( "a %s explode!" ), z.name() );
sounds::sound( z.pos(), 24, sounds::sound_t::combat, explode );
g->m.emit_field( z.pos(), emit_id( "emit_toxic_blast" ) );
}
开发者ID:Reclusive-reptile,项目名称:Cataclysm-DDA,代码行数:6,代码来源:mondeath.cpp
示例19: hit_monster_with_flags
// MATERIALS-TODO: use fire resistance
void game::hit_monster_with_flags(monster &z, unsigned int effects)
{
if (effects & mfb(AMMO_FLAME)) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(8, 20));
else if (z.made_of("flesh"))
z.add_effect(ME_ONFIRE, rng(5, 10));
} else if (effects & mfb(AMMO_INCENDIARY)) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(2, 6));
else if (z.made_of("flesh") && one_in(4))
z.add_effect(ME_ONFIRE, rng(1, 4));
} else if (effects & mfb(AMMO_IGNITE)) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(6, 6));
else if (z.made_of("flesh"))
z.add_effect(ME_ONFIRE, rng(10, 10));
}
}
开发者ID:Otaku-DDA,项目名称:Cataclysm-DDA,代码行数:28,代码来源:ranged.cpp
示例20: hit_monster_with_flags
// MATERIALS-TODO: use fire resistance
void game::hit_monster_with_flags(monster &z, const std::set<std::string> &effects)
{
if (effects.count("FLAME")) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(8, 20));
else if (z.made_of("flesh"))
z.add_effect(ME_ONFIRE, rng(5, 10));
} else if (effects.count("INCENDIARY")) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(2, 6));
else if (z.made_of("flesh") && one_in(4))
z.add_effect(ME_ONFIRE, rng(1, 4));
} else if (effects.count("IGNITE")) {
if (z.made_of("veggy") || z.made_of("cotton") || z.made_of("wool") ||
z.made_of("paper") || z.made_of("wood"))
z.add_effect(ME_ONFIRE, rng(6, 6));
else if (z.made_of("flesh"))
z.add_effect(ME_ONFIRE, rng(10, 10));
}
if (effects.count("BOUNCE")) {
z.add_effect(ME_BOUNCED, 1);
}
int stun_strength = 0;
if (effects.count("BEANBAG")) {
stun_strength = 4;
}
if (effects.count("LARGE_BEANBAG")) {
stun_strength = 16;
}
if( stun_strength > 0 ) {
switch( z.type->size )
{
case MS_TINY:
stun_strength *= 4;
break;
case MS_SMALL:
stun_strength *= 2;
break;
case MS_MEDIUM:
default:
break;
case MS_LARGE:
stun_strength /= 2;
break;
case MS_HUGE:
stun_strength /= 4;
break;
}
z.add_effect( ME_STUNNED, rng(stun_strength / 2, stun_strength) );
}
}
开发者ID:CinghialeCdda,项目名称:Cataclysm-DDA,代码行数:59,代码来源:ranged.cpp
注:本文中的monster类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论