ProjectilePrisonerRock::ProjectilePrisonerRock(bool bDirection, int xPos, int yPos)
{
	/* Set Sprite Number */
	SetSprite(1, CR::AssetList::prisoner_rock);

	/* Set Sprite Direction */
	SetDirection(bDirection);

	/* Set Weapon Bounding Box */
	SetWeaponBounds(12,12);

	/* Set Activate & Delay Timer */
	SetActiveTime(3);
	SetDelayTime(.25);

	/* Set Velocity Direction */	
	if(bDirection) SetVelocityVector((float)(rand()%50+75), 0);
	else SetVelocityVector((float)(-(rand()%50+75)), 0);

	/* Set Acceleration Vector */
	SetAccelerationVector(0, (float)(rand()%75 + 65));
	
	/* Set Start Position */
	SetPosition(xPos, yPos);

	/* Set Damage Value */
	SetWeaponDamage(5);

	proj_flags.S_NON_PROJECTILE = true;

	/* Initialize Sprite */
	SetAnimation(0, 0, true, false, 10, true);
}
ProjectileNinjaStar::ProjectileNinjaStar(bool bDirection, int xPos, int yPos)
{
	/* Set Sprite Number */
	SetSprite(1, CR::AssetList::ninja_star);


	/* Set Sprite Direction */
	SetDirection(bDirection);

	/* Set Weapon Bounding Box */
	SetWeaponBounds(16,16);

	/* Set Activate & Delay Timer */
	SetActiveTime(4);
	SetDelayTime(.25);

	/* Set Velocity Direction */
	if(bDirection) SetVelocityVector(80, 0);
	else SetVelocityVector(-80, 0);

	/* Set Start Position */
	SetPosition(xPos, yPos);

	/* Set Damage Value */
	SetWeaponDamage(2);	
	
	/* Initialize Sprite */
	SetAnimation(0, 0, true, false, 30, true);
	projectile_spr->EnableFrameSkip(false);
}
Ejemplo n.º 3
0
HPTRect &EnemyGreenNinja::GetWeaponWorldLoc()
{
	if((player_spr->GetFrameSet() == ENEMY_GREEN_NINJA_ANIM_ATTACK) && (player_spr->GetFrame() == 4))	
	{
		SetWeaponDamage(2);
		SetRectangle(rectWeaponWorldLoc, 25, 4, nxOffSet, 2);
	}
	else if((player_spr->GetFrameSet() == ENEMY_GREEN_NINJA_ANIM_ATTACK) && (player_spr->GetFrame() == 5))	
	{
		SetWeaponDamage(2);
		SetRectangle(rectWeaponWorldLoc, 25, 4, nxOffSet, -2);
	}
	else
		SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0);

	return rectWeaponWorldLoc;
}
HPTRect &EnemyDockWorkerWrench::GetWeaponWorldLoc()
{
	if((player_spr->GetFrameSet() == ENEMY_DOCK_WORKER_ANIM_ATTACK) && (player_spr->GetFrame() == 4))	
	{
		SetWeaponDamage(10);
		SetRectangle(rectWeaponWorldLoc, 25, 10, 0, 10);
	}
	else if((player_spr->GetFrameSet() == ENEMY_DOCK_WORKER_ANIM_ATTACK) && (player_spr->GetFrame() == 5))	
	{
		SetWeaponDamage(10);
		SetRectangle(rectWeaponWorldLoc, 50, 10, 0, 10);
	}
	else
		SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0);

	return rectWeaponWorldLoc;
}
Ejemplo n.º 5
0
void EnemyGMonsterFire::processAttack()
{


	if(!ipFlags.S_ATTACK && !ipFlags.S_DAMAGED && !ipFlags.S_DEAD)
	{
		if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(flame);
		
		ipFlags.S_ATTACK = true;
		SetWeaponDamage(base_enemy_dmg_6);
		SetAnimation(ENEMY_FIRE_MONSTER_ATTACK, 0, true, true, 16, true);
		player_spr->EnableFrameSkip(false);
	}
}
Ejemplo n.º 6
0
EnemyElectricField::EnemyElectricField(Level *curLevel, float tDelay, bool bOrientation, bool sDirection)
{
	SetRenderHealthBar(false);
	ipFlags.S_NO_GRAVITY = true;
	level_class = curLevel;

	this->tDelay = tDelay;
	this->bOrientation = bOrientation;

	dTimer = tDelay;

	this->sDirection = sDirection;

	SetWeaponDamage(10);
	ipFlags.S_VISIBLE = false;
	
}
EnemyZombiePrisoner::EnemyZombiePrisoner(Level *curLevel)
{
	SetRenderOffset(enemy_prisoner_zombie_render_offset);
	SetCurLife(enemy_prisoner_zombie_cur_life);
	SetNumLifeBars((int)(enemy_prisoner_zombie_cur_life * .2f + 1));
	SetDamageTimer(.25);
	SetWeaponDamage(3);
	level_class = curLevel;

	ipFlags.S_ATTACK = true;

	SetMaxWalkVelocity(static_cast<float>(rand()%30 + 30));

	rectDX = 15;
	rectDY = 45;
	rectXOffset = -nxOffSet;
	rectYOffset = -15;
}
Ejemplo n.º 8
0
void Enemy::InitEnemy(int nHitPoints, int nMaxXVelocity, int nMaxYVelocity, float nMaxXAcceleration, float nRecoveryTime, int nPointValue, bool bRenderHBar)
{
	SetWeaponDamage(0);

	SetCurLife(nHitPoints);
	SetNumLifeBars(static_cast<int>(nHitPoints * .20));

	if(GetNumLifeBars() <= 0)
		SetNumLifeBars(1);

	SetWalkAcceleration(nMaxXAcceleration);
	SetMaxWalkVelocity(static_cast<float>(nMaxXVelocity));
//	SetMaxJumpVelocity(nMaxYVelocity);
	SetDamageTimer(nRecoveryTime);
	SetEnergyLevel(0);
	SetExtraLives(0);
//	SetMaxClimbVelocity(0);

	SetRenderHealthBar(bRenderHBar);
}
Ejemplo n.º 9
0
EnemyWolfGawain::EnemyWolfGawain(Level *curLevel, IPlayer *player)
{
	maxWalkSpeed = 100.00;   
	ipFlags.S_NO_GRAVITY = true;

	SetCurLife(6);
	SetNumLifeBars(1);
	level_class = curLevel;
	SetDamageTimer(1);

	this->player = player;

	ipFlags.S_ATTACK = true;
	HIT = false;
	COLLISION = false;
	START = false;
	SetWeaponDamage(5);

//	SetMaxWalkVelocity(60);
}
Ejemplo n.º 10
0
EnemyPunk::EnemyPunk(Level *curLevel)
{
	InitEnemy(12, 
		      base_x_velocity,
			  base_y_velocity,
			  0,
			  1,
			  0,
			  true);

	SetRenderOffset(enemy_gmonstersmall_render_offset);
	level_class = curLevel;
	jumpMaxVelocity = -200.0;
	
	rectDX = 25;
	rectDY = 40;
	rectXOffset = -nOffSet;
	rectYOffset = -10;
	SetWeaponDamage(5);
}
Ejemplo n.º 11
0
void CBaseMelee::Swing()
{
	if(m_pPlayer->pev->flags & FL_DUCKING || m_pPlayer->pev->button & IN_DUCK)
		return;
	
	//BP to prevent players from stabbing right after getting up
	if(m_fNextStabTime > UTIL_WeaponTimeBase())
		return;

	SetWeaponDamage(pData->flSecondaryDmgModifier);

	TraceResult tr;

	UTIL_MakeVectors(m_pPlayer->pev->v_angle);
	Vector vecSrc	= m_pPlayer->GetGunPosition( );
	Vector vecEnd	= vecSrc + gpGlobals->v_forward * this->pData->flBladeLength;

	UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );

#ifndef CLIENT_DLL
	CBaseEntity *pHit = NULL;
	if ( tr.flFraction >= 1.0 )
	{
		UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
		if ( tr.flFraction < 1.0 )
		{
			// Calculate the point of intersection of the line (or hull) and the object we hit
			// This is and approximation of the "best" intersection
			pHit = CBaseEntity::Instance( tr.pHit );
			if ( !pHit || pHit->IsBSPModel() )
			{
				FindHullIntersection( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() );

			}
			vecEnd = tr.vecEndPos;	// This is the point on the actual surface (the hull could have hit space)
		}
	}

	if(tr.flFraction < 1.0)
	{
		pHit = CBaseEntity::Instance( tr.pHit );

		if (pHit && pHit->pev->takedamage)
		{
			float flDamage = m_pPlayer->GetDamage(m_pPlayer->pev, gpGlobals->v_forward, &tr);

			if(pHit->IsPlayer())
			{
				Vector vecOrg = tr.vecEndPos - gpGlobals->v_forward * 4;

				if ( g_pGameRules->FPlayerCanTakeDamage( m_pPlayer, pHit ) && flDamage != 0.0)
				{
					ClearMultiDamage( );
					pHit->TraceAttack(m_pPlayer->pev, flDamage, gpGlobals->v_forward, &tr, DMG_CLUB | DMG_NEVERGIB ); 
					ApplyMultiDamage( pev, m_pPlayer->pev );
					EMIT_SOUND(ENT(pev), CHAN_WEAPON, pData->snd_hit, 1, ATTN_NORM);
					SpawnBlood( vecOrg, BLOOD_COLOR_RED, flDamage * 4 ); // Make a lot of Blood!
				}
			}
			else
			{
				ClearMultiDamage( );
				pHit->TraceAttack(m_pPlayer->pev, flDamage, gpGlobals->v_forward, &tr, DMG_CLUB | DMG_NEVERGIB ); 
				ApplyMultiDamage( pev, m_pPlayer->pev );
			}
		}
		else
		{

			if(pData->snd_hitwall)
				EMIT_SOUND(ENT(pev), CHAN_AUTO, pData->snd_hitwall, 1, ATTN_NORM);

			DecalGunshot( &tr, BULLET_BLADE );
		}
	}
#endif
	m_pPlayer->SetAnimation( PLAYER_ATTACK1 );

	int flags;
#if defined( CLIENT_WEAPONS )
	flags = FEV_NOTHOST;
#else
	flags = 0;
#endif

	// use event secondary so that the bayonet weapons can use there events
	// melee weapons can use the same event for primary and secondary
	PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), pData->m_usSecondaryAttack, 0.0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0, m_pPlayer->pev->team, m_iId, 0, 0 );


	m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + pData->flAttackDelay;
	m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + pData->flAttackDelay;
	m_pPlayer->BurnStamina(MAX_STAMINA / 10, (float)0.1);
}