Jump to content
×
×
  • Create New...
  • 0

C++ -> function switch


Necro

Question

  • Premium

Hi, can i do code like this? 

 

if (pkAttacker->IsPC() == true)
{
switch (pkAttacker->GetJob())
{
case JOB_WARRIOR:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_WARRIOR)) / 100;
break;


case JOB_ASSASSIN:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_ASSASSIN)) / 100;
break;


case JOB_SURA:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_SURA)) / 100;
break;


case JOB_SHAMAN:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_SHAMAN)) / 100;
break;
}


switch (pkAttacker->GetEmpire())
{
case 1:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_SHINSO)) / 100;
break;


case 2:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_CHUNJO)) / 100;
break;


case 3:
iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_JINNO)) / 100;
break;
} 
}

two times switch?

 

Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

3 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.