Beispiel #1
0
bool Player::LevelUp()
{
	if (GetXP() < GetXPToLevelUp(level + 1))
		return false;

	level++;

	unsigned int statIncreases[3] = { 0, 0, 0 };
	float statMultipliers[3] = { 0, 0, 0 };
	statMultipliers[0] = 13.0f;
	statMultipliers[1] = className == "Fighter" ? 8.0f : 6.0f;
	statMultipliers[2] = className == "Rogue" ? 8.0f : 6.0f;

	for (int i = 0; i < 3; i++)
	{
		float base = std::tanh(level / 30.0) * ((level % 2) + 1);
		statIncreases[i] += static_cast<int>(1 + statMultipliers[i] * base);
	}

	SetHP(GetHP() + statIncreases[0]);
	SetMaxHP(GetMaxHP() + statIncreases[0]);
	SetStrength(GetStrength() + statIncreases[1]);
	SetAgility(GetAgility() + statIncreases[2]);

	std::cout << GetName() << " grew to level " << level << "!\n";
	std::cout << "Health   +" << statIncreases[0] << " -> " << GetMaxHP() << std::endl;
	std::cout << "Strength +" << statIncreases[1] << " -> " << GetStrength() << std::endl;
	std::cout << "Agility  +" << statIncreases[2] << " -> " << GetAgility() << std::endl;
	std::cout << "----------------\n";

	return true;
}
Beispiel #2
0
void ZModule_HPAP::OnDamage(MUID uidAttacker,int damage, float fRatio)
{
	m_LastAttacker = uidAttacker;

#ifndef _PUBLISH
	if (CheckQuestCheet() == true) return;
#endif

	if(m_bRealDamage)
	{
		ZObject* pAttacker = ZGetObjectManager()->GetObject(uidAttacker);
		if ((pAttacker) && (!IsPlayerObject(pAttacker)))
		{
			ZActor* pActor = (ZActor*)pAttacker;
			damage = (int)(damage * (pActor->GetQL() * 0.2f + 1));
		}

		int nHPDamage = (int)((float)damage * fRatio);
		int nAPDamage = damage - nHPDamage;

		if ((GetAP() - nAPDamage) < 0)
		{
			nHPDamage += (nAPDamage - GetAP());
			nAPDamage -= (nAPDamage - GetAP());
		}

		SetHP(GetHP() - nHPDamage);
		SetAP(GetAP() - nAPDamage);
	}
}
CHero::CHero(void) : CUnit(UT_HERO)
{
	SetHP(100);
	SetMaxHP(100);
	SetAttack(9);
	SetSpeed(4);
	SetRange(1);
	SetEXPValue(0);

	SetHasAttacked(false);
	SetShielded(false);
	SetIsMoving(false);

	// TODO: Setup abilities when they are in place5
	 
	// Finds specified spell for the Hero
	CAbilityManager * pAM = CAbilityManager::GetInstance();

	GiveSpell(SP_BLANK);
	GiveSpell(SP_BLANK);
	GiveSpell(SP_BLANK);
	GiveSpell(SP_BLANK);

	for (int i=0; i<4;++i)
		m_ncooldown[i]=0;
}
CEnemyDemon::CEnemyDemon()
{
    COptions *op = COptions::GetInstance();
    CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();

    SetHP(25 * op->GetDifficulty());
    SetVelX(100.0f * op->GetDifficulty());
    SetVelY(100.0f * op->GetDifficulty());
    SetXFlip(-1);
    SetHeight(64);
    SetWidth(64);
    SetPosX(500);
    SetPosY(500);
    SetType(ACTOR_ENEMY);
    SetPower(5 * op->GetDifficulty());
    SetScoreValue(100 * op->GetDifficulty());
    SetHit(false);

    rEnemyRect.top = 65;
    rEnemyRect.bottom = 123;
    rEnemyRect.left = 0;
    rEnemyRect.right = 60;

    m_nSoundID = CSGD_WaveManager::GetInstance()->LoadWave("Resource/sounds/JoA_Bark.wav");
    CSGD_WaveManager::GetInstance()->SetVolume(m_nSoundID,COptions::GetInstance()->GetSFXVolume()-40);


}
Beispiel #5
0
CCrate::CCrate(int x, int y) : CBaseObject(x,y)
{
	renderOrder = 3;
	ChangeAnimation(idle);
	SetHP(150);
	lookingLeft = false;
	content = nothing;
}
Beispiel #6
0
//七神
int CBossChen::Num7()
{
    deffence = 0;
    SetHP(2000);
    SetTime(50);
    double xx = GetX();
    double yy = GetY();
    for( int i = 0; i < 60; ++i ) {
        x += ( GAME_RIGHT-120 - xx ) / 60.0;
        y += ( GAME_CENTER_Y - yy ) / 60.0;
        mt.Suspend(1);
    }
    Suspend(60);
    deffence = 1;

    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-260,GAME_CENTER_Y+80, 1) );
    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-260,GAME_CENTER_Y-80, 2) );
    g_pMaterial->sndFire.Play(0);
    Suspend(180);

    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-120,GAME_CENTER_Y+200, 3) );
    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-120,GAME_CENTER_Y-200, 4) );
    g_pMaterial->sndFire.Play(0);
    Suspend(160);

    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-40,GAME_CENTER_Y+120, 5) );
    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-40,GAME_CENTER_Y-120, 6) );
    g_pMaterial->sndFire.Play(0);
    Suspend(180);
    g_lEnemy.Add( new CEnemy7God(GAME_RIGHT-200,GAME_CENTER_Y, 7) );
    g_pMaterial->sndFire.Play(0);

    Suspend(600);

    for( int i = 0;; i++ ) {
        CTamaNormal t;
        t.x = GetX();
        t.y = GetY();
        t.type = 12;
        t.color = 3;

        CDanmakuPolygons d(&t);
        d.n= 7;
        d.m = 5;
        d.sv = 1;
        d.ev = 1;
        if(GetDifficult()==DIFF_LUNATIC)
            d.t = 14;
        else
            d.t = 2*(1+GetDifficult());
        d.offset = 30;
        d.Fire();
        g_pMaterial->sndFire.Play(0);
        mt.Suspend(120);
    }
    return 1;
}
Beispiel #7
0
void GCastleForces::Init()
{
	guint32 level = GUserAbility::GetAbilityLevel( eIndexCastleMaxHP );
	gint32 hp = 1000 + 200 * (gint32)level;
	SetHP( hp );
	SetCurrentHP( hp );
	
	level = GUserAbility::GetAbilityLevel( eIndexCastleAutoHP );
	SetAutoRecoveryHP( 5 + level * 5 );
}
Beispiel #8
0
//通常攻撃1
int CBossChenBase::NormalAtack1() {
    flag = 1;
    deffence = 1;
    SetHP(1500);
    SetTime(30);
    while( 1 ) {
        mt.Suspend(60);
        for( int k = 0; k < 2; k++ ) {
            int jmax = 1+GetDifficult();
            for( int j = 0; j < jmax; j++ ) {
                //攻撃
                CTamaNormal tama;
                tama.x = GetX();
                tama.y = GetY();
                tama.type = 12;
                tama.color = 1;

                CDanmakuPolygons d(&tama);
                d.n= 4;
                d.m = 5;
                d.sv = 2;
                d.ev = 2;
                if(GetDifficult()==DIFF_LUNATIC)
                    d.t = 10;
                else
                    d.t = 2*(1+GetDifficult());
                d.offset = 45+90*j/jmax;

                d.Fire();
                g_pMaterial->sndFire.Play(0);
                mt.Suspend(60);
            }
            const int move_count = 30;
            int xv,yv;
            if( k ) {
                xv = 400 - GetX();
                yv = GAME_TOP + 120 - GetY();
            }
            else {
                xv = 500 - GetX();
                yv = GAME_BOTTOM - 120 - GetY();
            }
            for( int i = 0; i < move_count; i++ ) {
                x += xv / move_count;
                y += yv / move_count;
                mt.Suspend(1);
            }
            mt.Suspend(120);
        }
    }
    return 1;
}
Beispiel #9
0
//タテ
int CBossMystia::Tate(){
	SetHP(1500);
	SetTime(30);
	deffence = 0;
	for( int i = 0; i < 60; ++i ) {
		x += ( 500 - GetX() ) / 60;
		y += ( 50 - GetY() ) / 60;
		mt.Suspend(1);
	}
	mt.Suspend(60);
	flag = 1;
	deffence = 1;
	for( int c = 0; ; c++ ) {
		mt.Suspend(60);
		for( int k = 0; k < 2; k++ ) {
			int kk = k*2-1;
			//攻撃
			int imax = (GetDifficult()<=DIFF_HARD)?16*(1+GetDifficult()):128;
			for( int i = 0; i < imax; ++i ) {
				for( int j = 0; j < 2; j++ ){
					int jj = j*2-1;
					CTamaNormal tama;
					tama.x = GetX();
					tama.y = GetY();
					tama.type = 13;
					tama.color = j?6:7;
					tama.v = 2;

					CDanmakuNonDirectionalLine d(&tama);
					d.offset = 360.0*((double)(k-c%2)-(double)i/imax) + 180*j;
					d.w = 60*jj;
					d.sv = 0.8;
					d.ev = 1.3;
					if( GetDifficult() == DIFF_LUNATIC) {
						d.n = 1;
						d.m = 3;
					}else {
						d.n = 1;
						d.m = 1+GetDifficult();
					}
					d.Fire();
				}
				g_pMaterial->sndFire.Play(0);
				this->y -= 4.0*kk*64/imax;
				mt.Suspend(64.0/imax);
			}
			mt.Suspend(60);
		}
		mt.Suspend(120);
	}
	return 1;
}
CSwordsman::CSwordsman(void) : CUnit(UT_SWORDSMAN)
{
	SetHP(25);
	SetMaxHP(25);
	SetAttack(8);
	SetSpeed(3);
	SetRange(1);
	SetEXPValue(75);

	SetHasAttacked(false);
	SetShielded(false);
	SetIsMoving(false);
	// TODO: Setup abilities when they are in place
}
Beispiel #11
0
CCrate::CCrate(int x, int y, int _content) : CBaseObject(x, y)
{
	if (_content < numberOfItems && _content > 0)
	{
		content = _content;
	}
	else
	{
		content = nothing;
	}
	renderOrder = 3;
	ChangeAnimation(idle);
	SetHP(150);
	lookingLeft = false;
}
Beispiel #12
0
//全体動作
int CBossMystiaMiddle::Thread(){
	TSunFunctionCallback<CBossMystiaMiddle> fn;
	TSunFunctionCallback<CBossMystiaBase> fnb;

	//出現
	flag = 0;
	deffence = 0;
/*
	for( int i = 0; i < 46; i++ ){
		x -= 5;
		mt3.Suspend();
	}
	mt3.Suspend(30);
*/
	//会話
	g_pPlayer->Talk();
	pTalk = new CTalkMystia1();
	pTalk->Start();
	while( !pTalk->IsEnd() )
		mt3.Suspend();
	SAFE_DELETE(pTalk);
	g_pPlayer->Resume();

	//通常攻撃
	SetHP(1000);
	SetTime(20);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	this->AddItem(ITEM_1UP,1);

	//エフェクト
	flag = 0;
	deffence = 0;
	g_lEffect.Add( new CEffectBreak( GetX(), GetY() ));
	mt3.Suspend( 60 );

	//退却
	for( int i = 0; i < 46; i++ ){
		x += 5;
		mt3.Suspend();
	}
	return 1;
}
Beispiel #13
0
//陰陽「太極図」
int CBossChenMiddle::Taikyoku()
{
    flag = 1;
    deffence = 1;
    SetHP(2000);
    SetTime(40);
    Suspend(60);

    for( int i = 0; i < 60; ++i ) {
        x += ( 450 - GetX() ) / 60;
        y += ( GAME_CENTER_Y - GetY() ) / 60;
        mt.Suspend(1);
    }

    CTamaTaikyoku tama;
    tama.x = GetX();
    tama.y = GetY();
    tama.type = 12;
    tama.v = 3;
    int offset = 0.0;
    while(1) {
        for( int i = 0;; i++) {
            //攻撃
            tama.color = 1;
            tama.a = offset;
            g_lTama.Add( tama.Copy() );
            tama.color = 0;
            tama.a = offset + 180;
            g_lTama.Add( tama.Copy() );

            g_pMaterial->sndFire.Play(0);
            double m;
            if( GetDifficult() == DIFF_LUNATIC )
                m = 1.5*(4-GetDifficult());
            else
                m = 2.0*(4-GetDifficult());

            if( i > 120/m )
                offset += 3.0*m*Sin((double)i*2);
            this->Suspend(m);
        }
    }
    return 1;
}
Beispiel #14
0
BOOL CGate::InitProperty(CGateList::tagGate *p)
{
	SetName(p->cName);//名字
	SetLenth(p->wLenth);//长		
	SetWidth(p->wWidth);//宽
	SetLevel(p->wLevel);//等级
	SetGraphicsID(p->dwModelId);//模型ID
	SetMaxHP(p->wMaxHp);//最大HP
	SetHP(p->wMaxHp);	//当前HP
	SetUnAttack(p->bIsunbeatable);//是否无敌
	SetBlockType(p->byBlockType);//阻挡类型
	SetDef(p->lDef);//物防	
	SetMagicDef(p->lMagicDef);//魔防
	SetNameColor(p->wNameColor);//名字颜色
	SetHitSound(string(p->cHitSound));//击中音效
	SetDestorySound(string(p->cDestorySound));//损毁音效
	SetOpenSound(string(p->cOpenSound));//打开音效
	SetCloseSound(string(p->cCloseSound));//关闭音效
	return TRUE;
}
CEnemyPsycrow::CEnemyPsycrow()
{
	CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();
	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	COptions *op = COptions::GetInstance();

	pES->RegisterClient("psycrow fire", this);
	pES->RegisterClient("state transition 1", this);
	pES->RegisterClient("state transition 2", this);
	pES->RegisterClient("state transition 3", this);
	pES->RegisterClient("state transition 4", this);

	m_nState = PSYCROW_STATE1;
	m_nSoundID = CSGD_WaveManager::GetInstance()->LoadWave("Resource/sounds/JoA_Squawk.wav");
	CSGD_WaveManager::GetInstance()->SetVolume(m_nSoundID, op->GetSFXVolume() - 40);
	m_fFireReady = 5.0f;
	m_fHitTimer = 0.4f;
	m_nOffset = 0;
	bIsFired = false;
	m_fFiringTimer = 0.5f;
	m_fSineFloat = 3.14f;
	m_nColor = 255;
	m_nScale = 1.5f;

	SetHP(250 * op->GetDifficulty());
	SetVelX(75 * op->GetDifficulty());
	SetVelY(0.0f);
	SetXFlip(-1);
	SetHeight(84);
	SetWidth(70);
	SetPosX(320);
	SetPosY(240);
	SetPower(0);
	SetType(ACTOR_ENEMY);
	SetScoreValue(1000 * op->GetDifficulty());
	SetHit(false);
	pBullet = NULL;

	bIsFiring = false;

}
CEnemyBusiness::CEnemyBusiness()
{
	CSGD_EventSystem *pES = CSGD_EventSystem::GetInstance();
	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	COptions *op = COptions::GetInstance();
	CSGD_WaveManager *pWM = CSGD_WaveManager::GetInstance();

	pES->RegisterClient("businessman fire", this);

	SetHP(50 *op->GetDifficulty());
	SetVelX(-50.0f * op->GetDifficulty());
	SetVelY(0.0f);
	SetXFlip(-1);
	SetHeight(63);
	SetWidth(86);
	SetPosX(1000);
	SetPosY(220);
	SetPower(0);
	SetType(ACTOR_ENEMY);
	SetScoreValue(200 * op->GetDifficulty());
	SetHit(false);
	pBullet = NULL;

	bIsFiring = false;

	m_fFireReady = 5.0f;
	m_fHitTimer = 1.0f;
	m_nOffset = 0;
	m_fFiringTimer = 1.0f;

	rEnemyRect.top = 18;
	rEnemyRect.bottom = 61;
	rEnemyRect.left = 2;
	rEnemyRect.right = 54;

	m_nSoundID = pWM->LoadWave("Resource/sounds/JoA_Scream.wav");
	pWM->SetVolume(m_nSoundID,op->GetSFXVolume() - 25);
	

}
Beispiel #17
0
//ミステリーサークル
int CBossMystia::HalfCircle(){
	SetHP(2000);
	SetTime(30);
	deffence = 0;
	double tx = GetX();
	double ty = GetY();
	for( int i = 0; i < 60; ++i ) {
		x += ( 420 - tx ) / 60;
		y += ( GAME_CENTER_Y - ty ) / 60;
		mt.Suspend(1);
	}
	mt.Suspend(60);
	deffence = 1;
	while( 1 ) {
		for( int k = 0; ; k++ ) {
			//攻撃
			CTamaNormal tama;
			tama.x = GetX();
			tama.y = GetY();
			tama.type = 13;
			tama.color = (k%2)?1:3;
			tama.v = 1;

			CDanmakuNonDirectional d(&tama);
			if( GetDifficult() == DIFF_LUNATIC) {
				d.n = 128;
			}else {
				d.n = 32*(1+GetDifficult());
			}
			d.offset = 180*(k%2)+180.0/d.n*rand(0,1);
			d.w = 180.0+180.0/d.n;
			d.Fire();
			g_pMaterial->sndFire.Play(0);
			mt.Suspend(120-20*GetDifficult()-5*min(k,5+GetDifficult()));
		}
	}
	return 1;
}
Beispiel #18
0
void Enemy::Create(CreateInfo obj){
	SetXY(obj.x,obj.y);
	SetAngle(obj.angle);
	SetSpeed(obj.speed);
	SetVxVyFromSpeedAngle();
	SetImage(obj.image);
	_bulletImg = obj.bulletImage;
	SetHP(obj.hp);
	_hitW = obj.hitW;
	_hitH = obj.hitH;
	SetShotWait(0);
	_angleShotB4 = 0;
	_shotCnt = 0;
	_BornFunc = obj.BornFunc;
	_ShotFunc = obj.ShotFunc;
	_MoveFunc = obj.MoveFunc;
	_DeadFunc = obj.DeadFunc;
	SetDrawExp(1.0);
	SetDrawParam(255);
	SetDeletable(false); //敵が画面外から侵入することを想定し、最初は画面外にあっても消さない
	SetRotateWhenDraw(obj.rotateWhenDraw);
	SetBorn();
}
Beispiel #19
0
//八卦
int CBossChen::Num8()
{
    deffence = 0;
    SetHP(2000);
    SetTime(50);
    double xx = GetX();
    double yy = GetY();
    for( int i = 0; i < 60; ++i ) {
        x += ( GAME_RIGHT-120 - xx ) / 60.0;
        y += ( GAME_CENTER_Y - yy ) / 60.0;
        mt.Suspend(1);
    }
    Suspend(60);
    deffence = 1;
    for( int i = 0;; i++ ) {
        CTamaNormal t;
        t.x = GetX();
        t.y = GetY();
        t.type = 12;
        t.color = 2;

        CDanmakuPolygons d(&t);
        d.n= 8;
        d.m = 5;
        d.sv = 2;
        d.ev = 2;
        if(GetDifficult()==DIFF_LUNATIC)
            d.t = 14;
        else
            d.t = 2*(1+GetDifficult());
        d.offset = -90-180/8;
        d.Fire();
        g_pMaterial->sndFire.Play(0);

        t.color = 0;
        CDanmakuSegment d2(&t);
        mt.Suspend(30);
        for( int k = 0; k < 3; k++ ) {
            for( int j = 0; j < 8; j++ ) {
                if( (((j+i)%8)>>k)%2 ) {
                    d2.a1 = -90-180/8		+5+360/8*j;
                    d2.a2 = -90-180/8+360/8	-5+360/8*j;
                    d2.v1 = d2.v2 = 2;
                    d2.Set(d.t);
                    d2.Fire();
                } else {
                    d2.a1 = -90-180/8		+5+360/8*j;
                    d2.a2 = -90-180/8+180/8	-5+360/8*j;
                    d2.v1 = 2;
                    d2.v2 = 2*Cos(d2.a2-d2.a1);
                    d2.Set(d.t);
                    d2.Fire();
                    d2.a1 = -90-180/8+180/8	+5+360/8*j;
                    d2.a2 = -90-180/8+360/8	-5+360/8*j;
                    d2.v1 = 2*Cos(d2.a2-d2.a1);
                    d2.v2 = 2;
                    d2.Set(d.t);
                    d2.Fire();
                }
            }
            g_pMaterial->sndFire.Play(0);
            mt.Suspend(10);
        }

        mt.Suspend(30);
        t.color = 2;
        d.Fire();
        g_pMaterial->sndFire.Play(0);
        mt.Suspend(120);

        {
            CTamaNormal t;
            t.x = GetX();
            t.y = GetY();
            t.type = 4;
            t.color = 2;
            if(i%5==4) t.color=0;
            t.v = 2.0;

            CDanmakuNonDirectionalLine d(&t);
            d.n = 8;
            d.m = GetDifficult();
            d.sv = 2.0-0.4*GetDifficult();
            d.ev = 2.0+0.4*GetDifficult();
            d.w = 180/8*7;
            d.offset = 180/8+Atan2( g_pPlayer->GetX() - GetX(), g_pPlayer->GetY() - GetY());
            d.Fire();
            g_pMaterial->sndFire.Play(0);
            mt.Suspend(120);
        }
    }
Beispiel #20
0
//全体動作(出現〜会話〜通常攻撃〜スペルカード〜撃破)
int CBossMystia::Thread(){
	TSunFunctionCallback<CBossMystia> fn;
	TSunFunctionCallback<CBossMystiaBase> fnb;

	//出現
	flag = 0;
	deffence = 0;
	for( int i = 0; i < 46; i++ ){
		x -= 5;
		mt3.Suspend();
	}
	mt3.Suspend(30);

	//会話
	g_pPlayer->Talk();
	pTalk = new CTalkMystia2();
	pTalk->Start();
	while( !pTalk->IsEnd() )
		mt3.Suspend();
	SAFE_DELETE(pTalk);
	g_pPlayer->Resume();
	fntBoss.CreateList("Mystia",12);

	//通常攻撃
	SetHP(500);
	SetTime(20);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	//鳥居
	yami = 0;
	SpellCard();
	fn.SetFunction(this,&CBossMystia::Torii);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//通常攻撃
	SetHP(1000);
	SetTime(30);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	//横符
	SpellCard();
	fn.SetFunction(this,&CBossMystia::Yoko);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//通常攻撃
	SetHP(1500);
	SetTime(40);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	//縦符
	SpellCard();
	fn.SetFunction(this,&CBossMystia::Tate);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//通常攻撃
	SetHP(2000);
	SetTime(40);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	//闇符
	yami = 1;
	yami_r = 120;
	SpellCard();
	fn.SetFunction(this,&CBossMystia::Yoko);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//幕間
	flag = 0;
	deffence = 0;
	mt.Stop();
	mt3.Suspend(60);

	//酉符
	yami = 1;
	yami_r = 60;
	SpellCard();
	fn.SetFunction(this,&CBossMystia::Tate);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//幕間
	flag = 0;
	deffence = 0;
	mt.Stop();
	mt3.Suspend(60);

	//半円
	yami = 0;
	SpellCard();
	fn.SetFunction(this,&CBossMystia::HalfCircle);
	mt.Start(&fn,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();
	SpellEnd();

	//エフェクト
	mt.Stop();
	flag = 0;
	deffence = 0;
	g_lEffect.Add( new CEffectBreak( GetX(), GetY() ));
	g_pPlayer->Talk();
	mt3.Suspend( 60 );

	//画面外へ
	x=1000;

	//会話
	pTalk = new CTalkMystia3();
	pTalk->Start();
	while( !pTalk->IsEnd() )
	mt3.Suspend();
	SAFE_DELETE(pTalk);

	return 1;
}
Beispiel #21
0
int main(int argc, char *argv[]){

    FILE *infile, *outfile;
    char infilename[260], outfilename[260];
    char WaveId[4];
    wHeader infileHeader;
    fmtChunk infileChunk;
    unsigned long Count, DataSize, tmpDataSize, FilePos;
	unsigned int tmpRIFFSize;

    float LPCutoff, HPCutoff, Invert, VocalPan, Gain;
    float ChMix[4];
    double a1[3],b1[3],a2[3],b2[3];
    double LP_L_In[3], LP_L_Out[3], HP_L_In[3], HP_L_Out[3];
    double LP_R_In[3], LP_R_Out[3], HP_R_In[3], HP_R_Out[3];    
    double Left, Right, NewLeft, NewRight;
    unsigned long i, j, k;
    short percentage = 0;
    
    /* Display version and usage */
    printf("VoiX Version %s\n(http://vocaleliminator.sourceforge.net)\n", VERSION);

    if (argc==1) {printf("\nUsage: %s <infile> [outfile] [options]\n", argv[0]);
                  printf("\nOptions: <lowpass> <highpass> <invert> <pan> <gain>\n");
                  printf("\n<lowpass>: Cutoff frequency (in Hz) for low-pass filter\n");
                  printf("<highpass>: Cutoff frequency (in Hz) for high-pass filter\n");
                  printf("<invert>: Invert right channel to make it mono, 0=off 1=on\n");                  
                  printf("<pan>: Pan for Vocal Track: 0=center -100=left 100=right\n");
                  printf("<gain>: Gain (in dB) for output file\n");                  
                  printf("\nExample: %s input.wav output.wav 200 8000\n", argv[0]);
                  return(0);}
    strcpy(infilename,argv[1]); /* Copy input filename from first parameter */
    
    /* For Windows Drag & Drop*/
    char *FileExt = ".voix.wav";
    if (argc==2) {
                 strcpy(outfilename, infilename); strcat(outfilename,FileExt); 
                 } else strcpy(outfilename,argv[2]);
    /* Windows Drag & Drop End*/
    
    printf("Input: %s ", infilename);
    if (argc>=4) LPCutoff = atof(argv[3]); else LPCutoff = 200.0;
    if (argc>=5) HPCutoff = atof(argv[4]); else HPCutoff = 8000.0;
    if (argc>=6) Invert = atof(argv[5]); else Invert = 0.0;
    if (argc>=7) VocalPan = atof(argv[6]); else VocalPan = 0.0;
    if ((VocalPan<=-100.0)||(VocalPan>=100.0)) VocalPan = 0.0;
    if (argc>=8) Gain = atof(argv[7]); else Gain = 0.0;
    if ((Gain<-20.0)||(Gain>20.0)) Gain = 0.0;

    /* Read Header from Input Wave File*/
    if ((infile = fopen(infilename,"rb+")) == NULL) {
        printf("\n\nError(1): Could not open input file \"%s\".\n",infilename); return(1);}
    
    fread(&infileHeader, sizeof(infileHeader), 1, infile);
    if ((infileHeader.ID[0]!='R')||(infileHeader.ID[1]!='I')
       ||(infileHeader.ID[2]!='F')||(infileHeader.ID[3]!='F')) {
         printf("\n\nError(3): \"%s\" is not a standrad RIFF file.\n",infilename);
           fclose(infile); return(3);}

    fread(&WaveId, sizeof(WaveId), 1, infile);
    if ((WaveId[0]!='W')||(WaveId[1]!='A')||(WaveId[2]!='V')||(WaveId[3]!='E')) {
        printf("\n\nError(4): Could not find correct WAVE header form \"%s\".\n", infilename);
           fclose(infile); return(4);}

    fread(&infileHeader, sizeof(infileHeader), 1, infile);
    if ((infileHeader.ID[0]!='f')||(infileHeader.ID[1]!='m')
      ||(infileHeader.ID[2]!='t')||(infileHeader.ID[3]!=' ')) {
        printf("\n\nError(5): Could not find correct chunk header form \"%s\".\n", infilename);
           fclose(infile); return(5);}
    
    fread(&infileChunk, sizeof(infileChunk), 1, infile);
    fseek(infile, ftell(infile) + infileHeader.Length - 16, 0);
    /* Display the input file format*/
    if (infileChunk.FormatTag == 1) printf("(Windows PCM");
    if (infileChunk.FormatTag == 3) printf("(IEEE float");
    printf(", %d Hz, %d bit, ", infileChunk.SampleRate, infileChunk.Bits);
    if (infileChunk.Channels == 1) printf("mono)\n"); else
    if (infileChunk.Channels == 2) printf("stereo)\n"); else
    printf("%d channels)\n", infileChunk.Channels);
    /* end */
    if ((infileChunk.FormatTag!=0x0001)&&(infileChunk.FormatTag!=0x0003)) {
        printf("\nError(6): \"%s\" is not a PCM or IEEE float wave file.\n",infilename);
          fclose(infile); return(6);}
    if (infileChunk.Channels!=2) {
        printf("\nError(7): \"%s\" is not stereo.\n",infilename);
          fclose(infile); return(7);}
    if ((infileChunk.Bits!=8)&&(infileChunk.Bits!=16)&&(infileChunk.Bits!=24)&&(infileChunk.Bits!=32))
        { printf("\nError(8): VoiX could not process %d bit wave files.\n", infileChunk.Bits);
          fclose(infile); return(8);}
    if (infileChunk.Bits/8*infileChunk.Channels!=infileChunk.BlockAlign)
        { printf("\nError(9): VoiX could not process non-standrad wave files.\n");
          fclose(infile); return(9);}
    fread(&infileHeader, sizeof(infileHeader), 1, infile);
    while (((infileHeader.ID[0]!='d')||(infileHeader.ID[1]!='a')||
          (infileHeader.ID[2]!='t')||(infileHeader.ID[3]!='a'))
    &&(!feof(infile))) {
    fseek(infile, ftell(infile) + infileHeader.Length, 0); 
    fread(&infileHeader, sizeof(infileHeader), 1, infile);
    }
    if (feof(infile)) {
       printf("\nError(10): Could not find correct data header form \"%s\".\n", infilename);
         fclose(infile); return(10);}
    printf("Output: %s\n", outfilename);
    if ((outfile = fopen(outfilename,"wb+")) == NULL) {
        printf("\nError(2): Could not open output file \"%s\".\n",outfilename);
          fclose(infile); return(2);}
    
    /* Write Header to Output Wave File*/
    DataSize = infileHeader.Length;
    tmpDataSize = 0;
    strcpy(infileHeader.ID,"RIFF"); infileHeader.Length = tmpDataSize+36;
    fwrite(&infileHeader,sizeof(infileHeader),1,outfile);
    strcpy(WaveId,"WAVE"); fwrite(WaveId,sizeof(WaveId),1,outfile);
    strcpy(infileHeader.ID,"fmt "); infileHeader.Length = 16;
    fwrite(&infileHeader,sizeof(infileHeader),1,outfile);
    fwrite(&infileChunk,sizeof(infileChunk),1,outfile);
    strcpy(infileHeader.ID,"data"); infileHeader.Length = tmpDataSize;
    fwrite(&infileHeader,sizeof(infileHeader),1,outfile);    
    
    if ((LPCutoff < 1.00) || (LPCutoff > infileChunk.SampleRate/2 - 1)) LPCutoff = 1.00;
    if ((HPCutoff < 1.00) || (HPCutoff > infileChunk.SampleRate/2 - 1)) HPCutoff = infileChunk.SampleRate/2 - 1;
    if (HPCutoff < LPCutoff) HPCutoff = LPCutoff;
    printf("(i)Lowpass: %.1f Hz, Highpass: %.1f Hz\n", LPCutoff, HPCutoff);
    SetLP(infileChunk.SampleRate,LPCutoff,a1,b1);
    SetHP(infileChunk.SampleRate,HPCutoff,a2,b2);
    for (i=0;i<=2;i++) {
      LP_L_In[i]=0; LP_L_Out[i]=0;
      HP_L_In[i]=0; HP_L_Out[i]=0;
      LP_R_In[i]=0; LP_R_Out[i]=0;
      HP_R_In[i]=0; HP_R_Out[i]=0;
    }
    printf("(i)Invert: ");
    if (Invert == 1.00) printf("On"); else printf("Off");
    printf(" Vocal Pan: "); printf("%.1f", VocalPan);
    VocalPan = (VocalPan+100.00)/2.00;
    printf(" Gain: %.1f dB\n", Gain);
    Gain = pow(10.0,Gain/20.0);
    
    if (VocalPan <= 50.0) {
    ChMix[0] = 1.0;
    ChMix[1] = -(VocalPan/(100.0-VocalPan));
    ChMix[2] = 1.0;
    ChMix[3] = -(VocalPan/(100.0-VocalPan));
    }
    if (VocalPan > 50.0) {
    ChMix[0] = -((100.0-VocalPan)/VocalPan);
    ChMix[1] = 1.0;
    ChMix[2] = -((100.0-VocalPan)/VocalPan);
    ChMix[3] = 1.0;
    }
    if (Invert == 0.00) {
      if (VocalPan<=50.00) {
         ChMix[2] = -ChMix[2]; ChMix[3] = -ChMix[3];
      }else {
         ChMix[0] = -ChMix[0]; ChMix[1] = -ChMix[1];         
      }         
    }

    printf("(!)Press [Ctrl+C] to exit\n(i)Process: ");
    Count = 0;
    for (i = 1; i <= DataSize/infileChunk.BlockAlign; i++) {
        
        if (feof(infile)) {
                        printf("\nError(11): EOF(End of file) of input file detected.\n");
                        fclose(infile); fclose(outfile); return(11);
                        }
        BlockRead(&Left, infileChunk.Bits, infileChunk.FormatTag, infile);
        BlockRead(&Right, infileChunk.Bits, infileChunk.FormatTag, infile);      
      
        
        if (percentage<i*20/(DataSize/infileChunk.BlockAlign)) {
          tmpDataSize = Count*infileChunk.BlockAlign;
          FilePos = ftell(outfile);
          tmpRIFFSize = tmpDataSize + 36;
          fseek(outfile,4,0); fwrite(&tmpRIFFSize,sizeof(tmpRIFFSize),1,outfile);
          fseek(outfile,40,0); fwrite(&tmpDataSize,sizeof(tmpDataSize),1,outfile);        
          fseek(outfile,FilePos,0);
          percentage= i*20/(DataSize/infileChunk.BlockAlign);
          printf("."); if (percentage%5==0) printf("%d%c",percentage*5,'%');

        }
        
        Count++;
        LP_L_In[2]=Left; LP_R_In[2]=Right;
        LP_L_Out[2]=(b1[0]/a1[0])*LP_L_In[2]+(b1[1]/a1[0])*LP_L_In[1]+(b1[2]/a1[0])*LP_L_In[0]-(a1[1]/a1[0])*LP_L_Out[1]-(a1[2]/a1[0])*LP_L_Out[0];
        LP_R_Out[2]=(b1[0]/a1[0])*LP_R_In[2]+(b1[1]/a1[0])*LP_R_In[1]+(b1[2]/a1[0])*LP_R_In[0]-(a1[1]/a1[0])*LP_R_Out[1]-(a1[2]/a1[0])*LP_R_Out[0];

        HP_L_In[2]=Left; HP_R_In[2]=Right;
        HP_L_Out[2]=(b2[0]/a2[0])*HP_L_In[2]+(b2[1]/a2[0])*HP_L_In[1]+(b2[2]/a2[0])*HP_L_In[0]-(a2[1]/a2[0])*HP_L_Out[1]-(a2[2]/a2[0])*HP_L_Out[0];
        HP_R_Out[2]=(b2[0]/a2[0])*HP_R_In[2]+(b2[1]/a2[0])*HP_R_In[1]+(b2[2]/a2[0])*HP_R_In[0]-(a2[1]/a2[0])*HP_R_Out[1]-(a2[2]/a2[0])*HP_R_Out[0];
           
        NewLeft=(ChMix[0]*(Left-LP_L_Out[2]-HP_L_Out[2])+ChMix[1]*(Right-LP_R_Out[2]-HP_R_Out[2]))*Gain+LP_L_Out[2]+HP_L_Out[2];
        NewRight=(ChMix[2]*(Left-LP_L_Out[2]-HP_L_Out[2])+ChMix[3]*(Right-LP_R_Out[2]-HP_R_Out[2]))*Gain+LP_R_Out[2]+HP_R_Out[2];
      
        LP_L_In[0]=LP_L_In[1]; LP_L_In[1]=LP_L_In[2];
        LP_R_In[0]=LP_R_In[1]; LP_R_In[1]=LP_R_In[2];
        LP_L_Out[0]=LP_L_Out[1]; LP_L_Out[1]=LP_L_Out[2];
        LP_R_Out[0]=LP_R_Out[1]; LP_R_Out[1]=LP_R_Out[2]; 
      
        HP_L_In[0]=HP_L_In[1]; HP_L_In[1]=HP_L_In[2];
        HP_R_In[0]=HP_R_In[1]; HP_R_In[1]=HP_R_In[2];
        HP_L_Out[0]=HP_L_Out[1]; HP_L_Out[1]=HP_L_Out[2];
        HP_R_Out[0]=HP_R_Out[1]; HP_R_Out[1]=HP_R_Out[2];  
      
        BlockWrite(NewLeft, infileChunk.Bits, infileChunk.FormatTag, outfile);
        BlockWrite(NewRight,infileChunk.Bits, infileChunk.FormatTag, outfile);       
    }
    tmpDataSize = DataSize;
    FilePos = ftell(outfile);
    tmpRIFFSize = tmpDataSize + 36;
    fseek(outfile,4,0); fwrite(&tmpRIFFSize,sizeof(tmpRIFFSize),1,outfile);
    fseek(outfile,40,0); fwrite(&tmpDataSize,sizeof(tmpDataSize),1,outfile);        
    fseek(outfile,FilePos,0);    
    printf("\n(i)Done processing file!\n");
    fclose(infile); fclose(outfile); return(0);
}
Beispiel #22
0
//六芒
int CBossChen::Num6()
{
    deffence = 0;
    SetHP(1800);
    SetTime(50);
    double xx = GetX();
    double yy = GetY();
    for( int i = 0; i < 60; ++i ) {
        x += ( GAME_RIGHT-120 - xx ) / 60.0;
        y += ( GAME_CENTER_Y - yy ) / 60.0;
        mt.Suspend(1);
    }
    Suspend(60);
    deffence = 1;

    CTamaNormal t;
    t.x = GetX();
    t.y = GetY();
    t.type = 12;
    t.color = 1;

    CDanmakuPolygons d(&t);
    d.n= 3;
    d.m = 5;
    d.sv = 2;
    d.ev = 2;
    if(GetDifficult()==DIFF_LUNATIC)
        d.t = 12;
    else
        d.t = 2*(1+GetDifficult());
    d.offset = 30;
    d.Fire();
    d.offset = 180+30;
    d.Fire();
    g_pMaterial->sndFire.Play(0);
    mt.Suspend(120);

    TSunFunctionCallback<CBossChen> fn;
    fn.SetFunction(this,&CBossChen::Kagome);
    mt2.Start(&fn,0x8000);

    mt.Suspend(120);

    for( int j = 0; ; j++ ) {
        double xx = GAME_RIGHT - rand(120,220);
        double yy = GAME_CENTER_Y + rand( -160,160);
        for( int i = 0; i < 60; ++i ) {
            x += ( xx - GetX() ) / 60.0;
            y += ( yy - GetY() ) / 60.0;
            CDanmakuToPlayerLine d(&t);
            d.w = 60;
            d.n = 3;
            if( GetDifficult() == DIFF_LUNATIC) {
                d.m = 12.0;
                d.sv = 4.0;
                d.ev = -0.5;
            } else {
                d.m = 2 + 2 * GetDifficult();
                d.sv = 2.0 + 0.2 * GetDifficult();
                d.ev = 2.0 - 0.2 * GetDifficult();
            }
            d.Fire();
            g_pMaterial->sndFire.Play(0);
            mt.Suspend(60);

            {
                CDanmakuPolygons d(&t);
                d.n= 6;
                d.m = 5;
                d.sv = 2;
                d.ev = 2;
                if(GetDifficult()==DIFF_LUNATIC)
                    d.t = 12;
                else
                    d.t = 2*(1+GetDifficult());
                d.offset = 30;
                d.Fire();
                g_pMaterial->sndFire.Play(0);
                mt.Suspend(120);
            }
        }

    }
    return 1;
}
Beispiel #23
0
void ZModule_HPAP::OnDamage(MUID uidAttacker,float fDamage, float fRatio)
{
	_ASSERT(fDamage >= 0);
	if (fDamage < 0) fDamage *= -1.f;	// 해킹으로 음수대미지를 넣어서 회복할 수 있으므로..

	m_LastAttacker = uidAttacker;

	// 퀘스트 테스트용 치트 체크
#ifndef _PUBLISH
	if (CheckQuestCheet() == true) return;
#endif
	//jintriple3 디버그 레지스터 핵 방지 코드
	//내 캐릭터가 아니거나 npc가 아니면....
	//m_bRealDamage의 경우 내 클라이언트에서 실제로 데미지를 적용하나 안하나를 체크하는 변수.
	//MyCharacter 이거나 NPC만 내 클라이언트에서 데미지 적용.
	if(!m_bRealDamage.Ref())	
		PROTECT_DEBUG_REGISTER(!m_bRealDamage_DebugRegister)	//이걸 위해 새로운 변수 하나 더 사용.
			return;

	// NPC의 난이도 조절계수때문에 넣음
	ZObject* pAttacker = ZGetObjectManager()->GetObject(uidAttacker);
	if ((pAttacker) && (!IsPlayerObject(pAttacker)))
	{
		ZActor* pActor = (ZActor*)pAttacker;
		//fDamage = (int)(fDamage * (pActor->GetTC()));
		fDamage = fDamage * (pActor->GetQL() * 0.2f + 1);
	}

	// 내가 죽기전까지 얻은 데미지를 누적한다(일단 듀얼토너먼트 전용임)
	if(IsAccumulationDamage())
	{
		AccumulateDamage(fDamage);
#ifndef _PUBLISH	// 내부빌드에서 누적 대미지 정보 출력
		char szAccumulationDamagePrint[256];
		sprintf(szAccumulationDamagePrint, "피해 당한 누적대미지[%2.1f]", GetAccumulationDamage());
		ZChatOutput(MCOLOR(255, 200, 100), szAccumulationDamagePrint);
#endif
	}


	float fHPDamage = (float)((float)fDamage * fRatio);
	float fAPDamage = fDamage - fHPDamage;

	if ((GetAP() - fAPDamage) < 0)
	{
		fHPDamage += (fAPDamage - GetAP());
		fAPDamage -= (fAPDamage - GetAP());
	}

	SetHP(GetHP() - fHPDamage);
	SetAP(GetAP() - fAPDamage);
	
//jintriple3
/*	if(m_bRealDamage)
	{
		// NPC의 난이도 조절계수때문에 넣음
		ZObject* pAttacker = ZGetObjectManager()->GetObject(uidAttacker);
		if ((pAttacker) && (!IsPlayerObject(pAttacker)))
		{
			ZActor* pActor = (ZActor*)pAttacker;
			//damage = (int)(damage * (pActor->GetTC()));
			damage = (int)(damage * (pActor->GetQL() * 0.2f + 1));
		}*/

/*
		float fHPDamage = 0, fAPDamage = 0;

		fHPDamage = damage * fRatio;
		fAPDamage = damage * (1.0f - fRatio);

*/
	//jintripl3
/*
		int nHPDamage = (int)((float)damage * fRatio);
		int nAPDamage = damage - nHPDamage;

		if ((GetAP() - nAPDamage) < 0)
		{
			nHPDamage += (nAPDamage - GetAP());
			nAPDamage -= (nAPDamage - GetAP());
		}

		SetHP(GetHP() - nHPDamage);
		SetAP(GetAP() - nAPDamage);
	}*/
}
CEnemy::CEnemy()
{
	SetHP(10);
	
}
Beispiel #25
0
void Client::SetLevel(uint8 set_level, bool command)
{
        if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
                LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
                return;
        }

        EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
        LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
        lu->level = set_level;
        if(m_pp.level2 != 0)
                lu->level_old = m_pp.level2;
        else
                lu->level_old = level;

        level = set_level;

        if(IsRaidGrouped())
        {
                Raid *r = this->GetRaid();
                if(r){
                        r->UpdateLevel(GetName(), set_level);
                }
        }
        if(set_level > m_pp.level2)
        {
                if(m_pp.level2 == 0)
                        m_pp.points += 5;
                else
                        m_pp.points += (5 * (set_level - m_pp.level2));

                m_pp.level2 = set_level;
        }
        if(set_level > m_pp.level) {
            parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
        }

        m_pp.level = set_level;
        if (command){
                m_pp.exp = GetEXPForLevel(set_level);
                Message(15, "Welcome to level %i!", set_level);
                lu->exp = 0;
        }
        else {
                float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
                                                ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
                lu->exp =  (uint32)(330.0f * tmpxp);
    }
        QueuePacket(outapp);
        safe_delete(outapp);
        this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change

		LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level);

        CalcBonuses();
        if(!RuleB(Character, HealOnLevel))
        {
                int mhp = CalcMaxHP();
                if(GetHP() > mhp)
                        SetHP(mhp);
        }
        else
        {
                SetHP(CalcMaxHP());             // Why not, lets give them a free heal
        }
		
		DoTributeUpdate();
        SendHPUpdate();
        SetMana(CalcMaxMana());
        UpdateWho();
		if(GetMerc())
			UpdateMercLevel();
        Save();
}
Beispiel #26
0
//--------------------------------------------------------------------------------------------------
void Be5::DoAction4(BeUnit* Unit, BRect dest)
{//dynamite
	BBitmap* Frame[9];
	Frame[0] = GetAnim(Type, 2, 0, PlayerColor); //placement ->
	Frame[1] = GetAnimFlip(Type, 2, 0, PlayerColor); //placement <-
	Frame[2] = GetAnim(Type, 0, 2, PlayerColor); //protect himself
	Frame[3] = GetAnimFlip(Type, 7, 0, PlayerColor); //dynamite 1
	Frame[4] = GetAnimFlip(Type, 8, 0, PlayerColor); //dynamite 2
	Frame[5] = GetAnimFlip(Type, 9, 0, PlayerColor); //dynamyte 3
	Frame[6] = GetAnimFlip(Type, 10, 0, PlayerColor); //explosion
	Frame[7] = GetAnim(Type, 2, 0, PlayerColor);
	Frame[8] = GetAnim(Type, 4, 1, PlayerColor);
	
	int direction;
	BRect Target = dest;

	if(Position.left > dest.left || dest.left == 0)
	{dest.OffsetBy(32,0); direction = 1;}
	
	else
	{dest.OffsetBy(-32,0); direction = 0;}

	DoAction1(this, dest);
	BBitmap* idle = CurrentImage;
	CurrentImage = Frame[7];
	Update(Position); 
	snooze(SPEED * 2);

	SEffect()->Position = Position; 
	SEffect()->CurrentImage = Frame[8];
	SEffect()->Valid = true;

	rgb_color c;
	for(int a = 15; a != 255; a+=16)
	{
		for(int i = 0; i < 32; i++)
			for(int j = 0; j < 32; j++)
			{
				c = ((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)];
				if(!(c.red == 255 && c.green == 0 && c.blue == 255))
					((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)].alpha = a;
			}
		Update(Position);
		snooze((int)(SPEED/2));
	}

	//place dynamite
	SEffect()->CurrentImage = Frame[3];
	SEffect()->Position = Target;
	SEffect()->Update(Target);

	CurrentImage = Frame[0+direction];
	Update(Position); //back idle
	snooze(SPEED*2); 

	SEffect()->CurrentImage = Frame[4];
	SEffect()->Update(Target);
	snooze(SPEED*4);

	//protect himself
	CurrentImage = Frame[2];
	Update(Position); 
	snooze(SPEED*2); 

	SEffect()->CurrentImage = Frame[5];
	SEffect()->Update(Target);
	snooze(SPEED*4);

	SEffect()->CurrentImage = Frame[6];
	Unit->Hit(!((bool) direction));
	Update(Target); 
	snooze(SPEED*4);

	SEffect()->Position = Position;
	Hit(!((bool) direction));
	Update(Position); 
	snooze(SPEED*2);

	SEffect()->Valid = false;
	CurrentImage = idle; 
	Update(Target);
	Update(Position);

	Unit->SetHP(-Unit->GetHP()); //Max dammage 
	SetHP(-GetHP());

	//clean up
	delete Frame[0];
	delete Frame[1];
	delete Frame[2];
	delete Frame[3];
	delete Frame[4];
	delete Frame[5];
	delete Frame[6];
	delete Frame[7];
	delete Frame[8];
}
Beispiel #27
0
//鳥居
int CBossMystia::Torii(){
	SetHP(2000);
	SetTime(30);
	deffence = 0;
	for( int i = 0; i < 60; ++i ) {
		x += ( 420 - GetX() ) / 60;
		y += ( GAME_CENTER_Y - GetY() ) / 60;
		Suspend(1);
	}
	deffence = 1;
	Suspend(30);
	while( 1 ) {
		for( int k = 0; k < 2; ++k){
			//攻撃
			CTamaNormal tama;
			tama.x = GetX();
			tama.y = GetY();
			tama.type = 3;
			tama.color = 1;
			tama.v = 1;

			CDanmakuSegment d( &tama);
			d.v2 = 1.5;
			d.v1 = 1.5;

			d.a1 = -20;
			d.a2 = -180+20;
			d.Set( 4+4*GetDifficult() );
			d.Fire();
			g_pMaterial->sndFire.Play(0);
			Suspend(40);

			d.a1 = -40;
			d.a2 = +60;
			d.Set( 4+4*GetDifficult() );
			d.Fire();
			d.a1 = 180-60;
			d.a2 = 180+40;
			d.Set( 4+4*GetDifficult() );
			d.Fire();
			g_pMaterial->sndFire.Play(0);
			Suspend(40);

			d.a1 = -20;
			d.a2 = -180+20;
			d.Set( 4+4*GetDifficult() );
			d.Fire();
			g_pMaterial->sndFire.Play(0);
			Suspend(120);

			//移動
			const int move_count = 30;
			int xv,yv;
			if( k ) {
				xv = 400 - GetX();
				yv = GAME_TOP + 120 - GetY();
			}
			else {
				xv = 500 - GetX();
				yv = GAME_BOTTOM - 120 - GetY();
			}
			for( int i = 0; i < move_count; i++ ) {
				x += xv / move_count;
				y += yv / move_count;
				mt.Suspend(1);
			}
			mt.Suspend(120);
		}
	}
	return 1;
}
Beispiel #28
0
void Client::SetLevel(uint8 set_level, bool command)
{
	if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
		Log.Out(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
		return;
	}

	EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
	LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
	lu->level = set_level;
	if(m_pp.level2 != 0)
		lu->level_old = m_pp.level2;
	else
		lu->level_old = level;

	level = set_level;

	if(IsRaidGrouped()) {
		Raid *r = this->GetRaid();
		if(r){
			r->UpdateLevel(GetName(), set_level);
		}
	}
	if(set_level > m_pp.level2) {
		if(m_pp.level2 == 0)
			m_pp.points += 5;
		else
			m_pp.points += (5 * (set_level - m_pp.level2));

		m_pp.level2 = set_level;
	}
	if(set_level > m_pp.level) {
		parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
		/* QS: PlayerLogLevels */
		if (RuleB(QueryServ, PlayerLogLevels)){
			std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); 
		}
	}
	else if (set_level < m_pp.level){
		/* QS: PlayerLogLevels */
		if (RuleB(QueryServ, PlayerLogLevels)){
			std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
		}
	}

	m_pp.level = set_level;
	if (command){
		m_pp.exp = GetEXPForLevel(set_level);
		Message(CC_Yellow, "Welcome to level %i!", set_level);
		lu->exp = 0;
	}
	else {
		float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
		lu->exp = (uint32)(330.0f * tmpxp);
	}
	QueuePacket(outapp);
	safe_delete(outapp);
	this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change

	Log.Out(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);

	CalcBonuses();

	if(!RuleB(Character, HealOnLevel)) {
		int mhp = CalcMaxHP();
		if(GetHP() > mhp)
			SetHP(mhp);
	}
	else {
		SetHP(CalcMaxHP()); // Why not, lets give them a free heal
	}
	if(!RuleB(Character, ManaOnLevel))
	{
		int mp = CalcMaxMana();
		if(GetMana() > mp)
			SetMana(mp);
	}
	else
	{
		SetMana(CalcMaxMana()); // Why not, lets give them a free heal
	}

	SendHPUpdate();
	SendManaUpdate();
	UpdateWho();
	Save();
}
Beispiel #29
0
void Player::Update( float dTime)
{
	mDTime = dTime;
	if(mAttackDelay > 0)
		mAttackDelay -= dTime;
	if(mUserSkillDelay > 0)
		mUserSkillDelay -= dTime;
	if(mTypeSkillDelay > 0)
		mTypeSkillDelay -= dTime;
	switch (mPlayerState)
	{
	case PLAYER_STATE_IDLE:
		{
			if( mGameKeyStates.typeActiveSkillKey == KEYSTATE_PRESSED)
			{
				TransState(PLAYER_STATE_TYPESKILL);
				break;
			}
			if( mGameKeyStates.userActiveSkillKey == KEYSTATE_PRESSED)
			{
				TransState(PLAYER_STATE_USERSKILL);
				break;
			}
			if( mGameKeyStates.attackKey == KEYSTATE_PRESSED )
			{
				TransState(PLAYER_STATE_ATTACK);
				break;
			}
			else if ( mGameKeyStates.leftDirectKey ==  KEYSTATE_PRESSED 
				|| mGameKeyStates.rightDirectKey == KEYSTATE_PRESSED 
				|| mGameKeyStates.upDirectKey == KEYSTATE_PRESSED 
				|| mGameKeyStates.downDirectKey == KEYSTATE_PRESSED )
			{
				TransState(PLAYER_STATE_WALK);
			}else if ( mGameKeyStates.typeActiveSkillKey == KEYSTATE_PRESSED)
				TransState(PLAYER_STATE_TYPESKILL);
		}
		break;
	case PLAYER_STATE_WALK:
		{
			if( mGameKeyStates.typeActiveSkillKey == KEYSTATE_PRESSED)
			{
				TransState(PLAYER_STATE_TYPESKILL);
				break;
			}
			if( mGameKeyStates.userActiveSkillKey == KEYSTATE_PRESSED)
			{
				TransState(PLAYER_STATE_USERSKILL);
				break;
			}
			if( mGameKeyStates.attackKey == KEYSTATE_PRESSED )
			{
				TransState(PLAYER_STATE_ATTACK);
				break;
			}
			//Move myPlayer with Game Key States.
			//Check Moving Input, and set Position to d


			Point willGoDirection = Point(0,0);

			if ( mGameKeyStates.leftDirectKey ==  KEYSTATE_PRESSED )willGoDirection = willGoDirection + Point( -1.f, 0.f );
			if ( mGameKeyStates.rightDirectKey == KEYSTATE_PRESSED )willGoDirection = willGoDirection + Point( +1.f, 0.f );
			if ( mGameKeyStates.upDirectKey == KEYSTATE_PRESSED )	willGoDirection = willGoDirection + Point( 0.f, -1.f );
			if ( mGameKeyStates.downDirectKey == KEYSTATE_PRESSED )	willGoDirection = willGoDirection + Point( 0.f, +1.f );

			Point willGoPosition;

			//wasd 전부 다 땠는지 확인
			if ( mGameKeyStates.leftDirectKey ==  KEYSTATE_NOTPRESSED 
				&& mGameKeyStates.rightDirectKey == KEYSTATE_NOTPRESSED 
				&& mGameKeyStates.upDirectKey == KEYSTATE_NOTPRESSED 
				&& mGameKeyStates.downDirectKey == KEYSTATE_NOTPRESSED )
			{
				TransState(PLAYER_STATE_IDLE);
				break;
			}

			//지금 갈려고 하는 방향이 map에서 이동 불가능한 지역이니?
			if ( CouldGoPosition( GetPosition() + willGoDirection * dTime * 100.f ) == false )
			{
				//X좌표라도 갈수있니?
				if ( CouldGoPosition( GetPosition() + Point(willGoDirection.x,0) * dTime * 100.f ) == true )
				{
					willGoDirection = Point(willGoDirection.x,0);
				}
				//Y좌표라도 갈 수 있니?
				else if ( CouldGoPosition( GetPosition() +  Point(0,willGoDirection.y) * dTime * 100.f ) == true )
				{
					willGoDirection = Point(0,willGoDirection.y);
				}
				else
				{
					willGoDirection = Point(0,0);
				}
			}
			willGoPosition = GetPosition() + willGoDirection * dTime * 100.f;
			SetPosition(willGoPosition);


			//이전과 다른 방향으로 이동했니?
			if( mMoveDirection == Point(-10.f,-10.f) || mMoveDirection != willGoDirection)
			{
				mMoveDirection = willGoDirection;
				//방향바뀐 key정보를 보내야함.
				GameKeyStatesUpdateResult outPacket = GameKeyStatesUpdateResult();
				outPacket.mMyPlayerInfo = this->GetPlayerInfo();
				mClient->Broadcast(&outPacket);
			}

		}
		break;
	case PLAYER_STATE_ATTACK:
		{
			
			Point AttackPoint = mPosition + Point(cos(mRotation) * mAttackRange,sin(mRotation) * mAttackRange);
			std::map<int,Player*> players = GPlayerManager->GetPlayers();
			
			for( std::map<int,Player*>::iterator it = players.begin(); it != players.end(); ++it ) 
			{
				Player* enemy = it->second;
				if(enemy == this)continue;
				
				if( Point().GetDistance( enemy->GetPosition(), AttackPoint ) - mRadius < mAttackRange )
				{
					//피격데스네
					enemy->Damaged(mDamage+rand()%10);
				}
			}
			TransState(PLAYER_STATE_IDLE);
			break;
		}
		break;

	case PLAYER_STATE_DIE:
		{
			mResponTime -= dTime;
			if(mResponTime < 0)
			{
				//살려내야합니다.
				while(1)
				{
					float x = rand() % (GGameMap->GetWidth() * 64);
					float y = rand() % (GGameMap->GetHeight() * 64);
					if(CouldGoPosition(Point(x,y)) == true)
					{
						mPosition = Point(x,y);
						break;
					}
				}
				SetHP(100);
				TransState(PLAYER_STATE_IDLE);
				break;
			}
		}
		break;
	case PLAYER_STATE_TYPESKILL:
		{
			TransState(PLAYER_STATE_IDLE);
			break;
		}
		break;
	case PLAYER_STATE_USERSKILL:
		{
			TransState(PLAYER_STATE_IDLE);
			break;
		}
		break;
	default:
		break;
	}
}
void CObject_Appletree::Update()
{
	Center = WorldX + GetWidth()/2;
	SetAttackBox(0, 0, 0, 0);

	if(HeroForEnemy->GetWorldX()+100 < Center && !b_Attack)	// Hero가 왼쪽에 있을 때
	{
		b_left = true;
		b_right = false;
	}
	else if(HeroForEnemy->GetWorldX()+100 > Center && !b_Attack)
	{
		b_left = false;
		b_right = true;
	}

	// 인식범위 설정
	int RcnzX = Center;
	if(b_left) {
		RcnzX -= RecognizeRange;
	}
	else if(b_right) {
		RcnzX += RecognizeRange;
	}
	
	// 공격범위 설정
	int AtkX = Center;
	if(b_left) {
		AtkX -= AttackRange;
	}
	else if(b_right) {
		AtkX += AttackRange;
	}

	// 인식범위 내에서의 행동따윈 필요없다.

	// 공격범위 내에서의 행동
	if(GetHP() > 0)
	{
		if(HeroForEnemy->GetWorldX()+100 > AtkX && b_left)
		{
			if(AttackCount == -1 ) {
				SetAttack(true);
				AttackCount = 0;
			}
			if(Poison->GetCount() >= 1 && Poison->GetCount() <= 2) {
				SetAttackBox((int)GetDrawX()+30, (int)GetDrawY()+250, 191, 220);
			}

			for(int i=0; i<2; i++)
			{
				if(Break[i]->GetCount() >=1 && Break[i]->GetCount() <= 3) {
					SetAttackBox((int)GetDrawX()+25, (int)GetDrawY()+400, 180, 100);
				}
			}

			b_apple[0] = true;
		}
		else if(HeroForEnemy->GetWorldX()+100 < AtkX && b_right)
		{
			if(AttackCount == -1 ) {
				SetAttack(true);
				AttackCount = 0;
			}
			if(Poison->GetCount() >= 1 && Poison->GetCount() <= 2) {
				SetAttackBox((int)GetDrawX()+30, (int)GetDrawY()+250, 250, 220);
			}
			
		}

		if(AttackCount != -1) {
			AttackCount++;
		}
		
		if(Poison->GetCount() >= 6) {
			Poison->SetCount(0);
			SetAttack(false);
		}
		

		if(AttackCount > AttackDelay) {
			AttackCount = -1;
			Poison->SetCount(0);
			SetAttack(false);
		}
	}



	
	// 충돌박스 설정
	SetBoundBox((int)GetDrawX()+100, (int)GetDrawY()+50, 158, 400);
	
	// Hero와의 충돌판정
	if(GetHP() > 0)
	{
		if(CCollision::GetCollision()->Box_n_Box(
			HeroForEnemy->GetBoundX()-1, HeroForEnemy->GetBoundY(), HeroForEnemy->GetBoundX()+HeroForEnemy->GetBoundWidth()+1, HeroForEnemy->GetBoundY()+HeroForEnemy->GetBoundHeight(),
			GetBoundX(), GetBoundY(), GetBoundX()+GetBoundWidth(), GetBoundY()+GetBoundHeight()))
		{
			if(HeroForEnemy->GetWorldX()+100 < Center)	// Hero가 왼쪽에 있을 때
			{
				//HeroForEnemy->MoveTo(GetWorldX() + (int)((GetWidth()-GetBoundWidth())/2) - HeroForEnemy->GetWidth() + (int)((HeroForEnemy->GetWidth() - HeroForEnemy->GetBoundWidth())/2), HeroForEnemy->GetWorldY());
				HeroForEnemy->MoveTo(GetWorldX() + (int)((GetWidth()-GetBoundWidth())/2) - 115, HeroForEnemy->GetWorldY());
			}
			
			else if(HeroForEnemy->GetWorldX()+100 >= Center)	// Hero가 오른쪽에 있을 때
			{
				HeroForEnemy->MoveTo(GetWorldX() + GetWidth() - (int)((GetWidth()-GetBoundWidth())/2) - (int)((HeroForEnemy->GetWidth()-HeroForEnemy->GetBoundWidth())/2), HeroForEnemy->GetWorldY());
			}
			
		}
	}

	
	// Hero에게 공격판정
	if(CCollision::GetCollision()->Box_n_Box(
		HeroForEnemy->GetBoundX(), HeroForEnemy->GetBoundY(), HeroForEnemy->GetBoundX()+HeroForEnemy->GetBoundWidth(), HeroForEnemy->GetBoundY()+HeroForEnemy->GetBoundHeight(),
		GetAttackX(), GetAttackY(), GetAttackX()+GetAttackWidth(), GetAttackY()+GetAttackHeight()))
	{
		if(!HeroForEnemy->GetHit())
		{
			int dmg = (int)GetDmg();
			if(b_left)
			{
				if(HeroForEnemy->GetWay() == 1 && HeroForEnemy->GetGuard()) {
					dmg = (int)(dmg * 0.3f);
					HeroForEnemy->SetGuardHit(TRUE);
				}
			}
			else if(b_right)
			{
				if(HeroForEnemy->GetWay() == 0 && HeroForEnemy->GetGuard()) {
					dmg = (int)(dmg * 0.3f);
					HeroForEnemy->SetGuardHit(TRUE);
				}
			}
			HeroForEnemy->SetHP(HeroForEnemy->GetHP() - dmg);
			HeroForEnemy->SetHit(true);
			//SetAttack(false);
			if(HeroKnockbackCount == -1)
			{
				HeroKnockbackCount = 0;
			}
		}
	}
	
	// 넉백
	if(HeroKnockbackCount != -1)
	{
		if(HeroForEnemy->GetWorldX()+100 < Center)		// Hero가 왼쪽에 있을 때
		{
			if(HeroForEnemy->GetGuard()) {
				HeroForEnemy->MoveTo(HeroForEnemy->GetWorldX()-2, HeroForEnemy->GetWorldY());
			}
			else {
				HeroForEnemy->MoveTo(HeroForEnemy->GetWorldX()-3, HeroForEnemy->GetWorldY());
			}
		}
		else if(HeroForEnemy->GetWorldX()+100 > Center)	// Hero가 오른쪽에 있을 때
		{
			if(HeroForEnemy->GetGuard()) {
				HeroForEnemy->MoveTo(HeroForEnemy->GetWorldX()+2, HeroForEnemy->GetWorldY());
			}
			else {
				HeroForEnemy->MoveTo(HeroForEnemy->GetWorldX()+3, HeroForEnemy->GetWorldY());
			}
		}

		if(HeroKnockbackCount >= 15) {
			HeroKnockbackCount = -1;
			Hit->SetCount(0);
		}
		else {
			HeroKnockbackCount++;
		}
	}
	
	// Hero에게 피격판정
	if(GetHP() > 0)
	{
		if(CCollision::GetCollision()->Box_n_Box(
			HeroForEnemy->GetAttackX(), HeroForEnemy->GetAttackY(), HeroForEnemy->GetAttackX()+HeroForEnemy->GetAttackWidth(), HeroForEnemy->GetAttackY()+HeroForEnemy->GetAttackHeight(),
			GetBoundX(), GetBoundY(), GetBoundX()+GetBoundWidth(), GetBoundY()+GetBoundHeight()) ||
			CCollision::GetCollision()->Box_n_Box(
			HeroForEnemy->GetSkillX(), HeroForEnemy->GetSkillY(), HeroForEnemy->GetSkillX()+HeroForEnemy->GetSkillWidth(), HeroForEnemy->GetSkillY()+HeroForEnemy->GetSkillHeight(),
			GetBoundX(), GetBoundY(), GetBoundX()+GetBoundWidth(), GetBoundY()+GetBoundHeight()) )
		{
			b_apple[1] = true;
			Poison->SetCount(0);
			SetHit(true);
			if(HitCount == -1) {
				HitCount = 0;

				SetHP(GetHP() - HeroForEnemy->GetDmg());
			}

			if(KnockbackCount == -1) {
				KnockbackCount = 0;
			}
		}
		/*
		if(KnockbackCount != -1)
		{
			if(HeroForEnemy->GetWorldX()+100 < Center)		// Hero가 왼쪽에 있을 때
			{
				MoveTo(GetWorldX()+2, GetWorldY());

			}
			else if(HeroForEnemy->GetWorldX()+100 > Center)	// Hero가 오른쪽에 있을 때
			{
				MoveTo(GetWorldX()-2, GetWorldY());
			}

			if(KnockbackCount >= 10) {
				KnockbackCount = -1;
			}
			else {
				KnockbackCount++;
			}
		}

		if(GetHP() <= 0)
		{
			HeroForEnemy->SetExp(HeroForEnemy->GetExp() + GetExp());
		}
		*/
		if(HitCount >= 0)
		{
			HitCount++;
			if(HitCount >= 20) {
				HitCount = -1;
				SetHit(false);
				//HitEffect->SetCount(0);
			}
		}
	}
	/*
	// 벽
	if(GetWorldX() < -76)
	{
		WorldX = -76;
	}
	*/
	if(GetHP() < 0)
	{
		Opacity -= 6;
		b_Move = false;
		b_Attack = false;
	}
}