コード例 #1
0
void fungal_effects::fungalize( const tripoint &sporep, Creature *origin, double spore_chance )
{
    int mondex = gm.mon_at( sporep );
    if( mondex != -1 ) { // Spores hit a monster
        if( gm.u.sees( sporep ) &&
            !gm.zombie( mondex ).type->in_species( FUNGUS ) ) {
            add_msg( _( "The %s is covered in tiny spores!" ),
                     gm.zombie( mondex ).name().c_str() );
        }
        monster &critter = gm.zombie( mondex );
        if( !critter.make_fungus() ) {
            // Don't insta-kill non-fungables. Jabberwocks, for example
            critter.add_effect( effect_stunned, rng( 1, 3 ) );
            critter.apply_damage( origin, bp_torso, rng( 25, 50 ) );
        }
    } else if( gm.u.pos() == sporep ) {
        player &pl = gm.u; // TODO: Make this accept NPCs when they understand fungals
        ///\EFFECT_DEX increases chance of knocking fungal spores away with your TAIL_CATTLE

        ///\EFFECT_MELEE increases chance of knocking fungal sports away with your TAIL_CATTLE
        if( pl.has_trait( trait_id( "TAIL_CATTLE" ) ) &&
            one_in( 20 - pl.dex_cur - pl.get_skill_level( skill_id( "melee" ) ) ) ) {
            pl.add_msg_if_player(
                _( "The spores land on you, but you quickly swat them off with your tail!" ) );
            return;
        }
        // Spores hit the player--is there any hope?
        bool hit = false;
        hit |= one_in( 4 ) && pl.add_env_effect( effect_spores, bp_head, 3, 90, bp_head );
        hit |= one_in( 2 ) && pl.add_env_effect( effect_spores, bp_torso, 3, 90, bp_torso );
        hit |= one_in( 4 ) && pl.add_env_effect( effect_spores, bp_arm_l, 3, 90, bp_arm_l );
        hit |= one_in( 4 ) && pl.add_env_effect( effect_spores, bp_arm_r, 3, 90, bp_arm_r );
        hit |= one_in( 4 ) && pl.add_env_effect( effect_spores, bp_leg_l, 3, 90, bp_leg_l );
        hit |= one_in( 4 ) && pl.add_env_effect( effect_spores, bp_leg_r, 3, 90, bp_leg_r );
        if( hit ) {
            add_msg( m_warning, _( "You're covered in tiny spores!" ) );
        }
    } else if( gm.num_zombies() < 250 && x_in_y( spore_chance, 1.0 ) ) { // Spawn a spore
        if( gm.summon_mon( mon_spore, sporep ) ) {
            monster *spore = gm.monster_at( sporep );
            monster *origin_mon = dynamic_cast<monster *>( origin );
            if( origin_mon != nullptr ) {
                spore->make_ally( origin_mon );
            } else if( origin != nullptr && origin->is_player() &&
                       gm.u.has_trait( trait_id( "THRESH_MYCUS" ) ) ) {
                spore->friendly = 1000;
            }
        }
    } else {
        spread_fungus( sporep );
    }
}
コード例 #2
0
bool fungal_effects::marlossify( const tripoint &p )
{
    auto &terrain = m.ter( p ).obj();
    if( one_in( 25 ) && ( terrain.movecost != 0 && !m.has_furn( p ) )
        && !terrain.has_flag( TFLAG_DEEP_WATER ) ) {
        m.ter_set( p, t_marloss );
        return true;
    }
    for( int i = 0; i < 25; i++ ) {
        if( !spread_fungus( p ) ) {
            return true;
        }
    }
    return false;
}