global script hpmpcounters{ void run(){ InitializeGhostZHData(); int whipCooldownTimer = 0; int LinkX = Link->X; int LinkY = Link->Y; int fastWalkTimer; int lastScreen = Game->GetCurDMapScreen(); int lastDMap = Game->GetCurDMap(); while(true) { Game->Counter[CR_SCRIPT2] = Link->HP; Game->Counter[CR_SCRIPT3] = Link->MP; Game->Counter[CR_SCRIPT4] = Link->MaxHP; Game->Counter[CR_SCRIPT5] = Link->MaxMP; //bool false; //Figure out what this is however you want //if(Link->Item[id] != value) //Link->Item[id] = value; if ( ownStaff == true && Link->Item[88] == true && Link->MP == 0 ) { Link->Item[88] = false; } if ( ownStaff == true && Link->Item[88] == false && Link->MP > 0 ) { Link->Item[88] = true; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 98 ) { Game->MCounter[CR_XP] = 9999; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 98 && Game->Counter[CR_XP] > 9999 ) { Game->Counter[CR_XP] = 9999 ; } baseWalletSpace = ( walletSize * walletsOwned ); totalWalletSpace = ( baseWalletSpace + CR_CUSTOM_WALLET_SIZE ); totalPocketSpace = ( pockets * pocketCapacity ); totalPocketAndWalletSpace = ( totalWalletSpace + totalPocketSpace ); freePocketSpace = ( totalPocketSpace - pocketSpaceUsed ); freeWalletSpace = ( totalWalletSpace - walletSpaceUsed ); freeSpace = ( freePocketSpace + freeWalletSpace ); Game->Counter[CR_FREE_SPACE] = freeSpace; //if (Game->Counter[CR_RUPEES] > 0 && Game->MCounter[CR_RUPEES] < 9999 ) { // Game->MCounter[CR_RUPEES] = 9999; //} if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 98 ) { Game->MCounter[CR_XP] = 9999; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 98 && Game->Counter[CR_XP] > 9999 ) { Game->Counter[CR_XP] = 9999 ; } UpdateEWeapons(); CleanUpGhostFFCs(); // Only needed if __GH_USE_DRAWCOMBO is 0 UpdateLWeapons(); UpdateLastItem(); //if (Link->PressB) {LastItemUsed = GetEquipmentB();} //if (Link->PressA) {LastItemUsed = GetEquipmentA();} // if ( itemActivate ){ // UseItemOnB(65); // itemActivate = false; // } // else if ( !itemActivate ){ // } //Whip Cooldown Timer if ( whipCooldownTimer > 0 ) whipCooldownTimer--; if ( gogglesOn && Link->MP ){ //Decrement magic gogglesTimer = (gogglesTimer+1) % TIME_PER_MP; if ( !gogglesTimer ) Link->MP--; Screen->Rectangle(6, 0, 0, 256, 172, 4, 1, 0, 0, 0, true, 64); if ( Link->MP <= 0 //If magic ran out && Link->Item[I_AMULET1] ) { //Take off goggles. gogglesOn = false; Link->Item[I_AMULET1] = false; // Waitframes(1); } } else if ( !gogglesOn && Link->Item[I_AMULET1] ){ //Disable Goggles Link->Item[I_AMULET1] = false; //Waitframes(1); } paddle(); swordOfLightSwitcher(); timedItem(); cigarActive(); Trace(currentDamage); Waitdraw(); Set_Weapon_Damage(1); //This function includes the argument (int index). What value should be passed here? I'm using (1) as a placeholder. doenemyhit(1); //digiVolveEnemies(); XP(); AutoGhost(); DrawGhostFFCs(); { if (Link->Item[231] == true) //If Link has the fake item designated in D0 { Link->Item[230] = false; //Removes the fake item user selects in D0 Link->Item[231] = false; //Removes the item the user selects in in D1 Link->MP += 256; //Increases MP by value of D3 Link->MaxMP += 256; //Increases Max MP by value of D2 } else (Link->Item[230] == true); //Gives Link the specified item in D4.{ } { if(SecretTimer > -1) { SecretTimer--; if (SecretTimer == -1) { Screen->TriggerSecrets(); Game->PlaySound(27);}} } float angle; { if (usebombodo == 1) { slower ++; if (slower == 5) { rad++; slower = 0; } angle = (angle + ORBIT_SPEED) % 360; f1 = 100 + rad * Cos(angle); f2 = 100 + rad * Sin(angle); // Screen->FastCombo(6, f1, f2, 95, 2, 128); r1 = 40+Rand(150); r2 = 40+Rand(100); slowera++; if (slowera == 20) { slowera = 0; if (bombs < 30) { bombs ++; lweapon bomb = CreateLWeaponAt(LW_BOMBBLAST, r1, r2); Game->PlaySound(SFX_BOMB); if (bombs == 30) usebombodo = 0; } } } /////////////////////// /// BEHIN XP SCRIPT /// /////////////////////// //Exp gain and level up //XP(); //Fast walk if ( Link->Item[I_FASTWALK] ){ fastWalkTimer++; fastWalkTimer %= EXP_FASTWALKRATE; if ( fastWalkTimer == 0 ) fastWalk(1); } //Treasure Hunter if ( Link->Item[I_TREASUREHUNTER] //If skill learned && (lastScreen != Game->GetCurDMapScreen() || lastDMap != Game->GetCurDMap()) //If new screen && checkScreenFlag(SF_TREASURE) //And flag active && !Screen->State[ST_ITEM] //And item not taken && !Screen->State[ST_CHEST] && !Screen->State[ST_LOCKEDCHEST] && !Screen->State[ST_BOSSCHEST] ){ Game->PlaySound(SFX_TREASURESCREEN); //Play SFX } lastScreen = Game->GetCurDMapScreen(); //Update last screen/DMap lastDMap = Game->GetCurDMap(); ///////////////////// /// END XP SCRIPT /// ///////////////////// Waitframe(); } if ( ringOn && Link->MP ){ //Decrement magic ringTimer = (ringTimer+1) % ringTimePerMP; if ( !ringTimer ) Link->MP--; //Draw shadow under Link //Screen->FastTile( 2, Link->X, Link->Y, ringShadowTile, ringShadowCset, OP_TRANS ); if ( Link->MP <= 0 //If magic ran out ){ //Take off ring ringOn = false; Link->CollDetection = true; Link->Invisible = false; } } else if ( !ringOn ){ //Disable ring Link->CollDetection = true; Link->Invisible = false; } ////////////// ///END RING/// ////////////// ///////////////////////// ///BEGIN CANE OF BYRNA/// ///////////////////////// if ( byrnaOn && Link->MP > 0 ){ //Decrement magic byrnaTimer = (byrnaTimer+1) % byrnaTimePerMP; if ( !byrnaTimer ) Link->MP--; if ( Link->MP <= 0 //If magic ran out || Link->Action == LA_SCROLLING //Or left screen ){ //Take off ring byrnaOn = false; } } else if ( !byrnaOn ){ //Disable ring } /////////////////////// ///END CANE OF BYRNA/// /////////////////////// ///////////////// ///BEGIN BOOTS/// ///////////////// if ( bootsOn && Link->MP ){ //Decrement magic bootsTimer = (bootsTimer+1) % bootsTimePerMP; if ( !bootsTimer ) Link->MP--; if ( Link->MP <= 0 //If magic ran out || Link->Action == LA_SCROLLING //Or left screen ){ //Take off ring bootsOn = false; } } else if ( !bootsOn ){ //Disable ring } /////////////// ///END BOOTS/// /////////////// } } } ////////////////////// /// BEGIN LEVELING /// ////////////////////// //Check for new enemies and set their max HP void setMaxHP(){ for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc enem = Screen->LoadNPC(i); if ( enem->Misc[NPC_MISC_MAXHP] == 0 ) enem->Misc[NPC_MISC_MAXHP] = enem->HP; } } void checkEnemiesKilled(){ for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc enem = Screen->LoadNPC(i); if ( enem->HP <= 0 && enem->HP > HP_DEAD ){ enem->HP = HP_DEAD; int worth = enemyEXPWorth(enem); //Leadership: Chance to increase EXP worth if ( Link->Item[I_LEADERSHIP] && Rand(EXP_LEADERSHIPCHANCE) == 0 ) worth++; giveEXP(worth); } } } //void expMeter(){ // int length = EXP_METER_LENGTH * Game->Counter[CR_SCRIPT6] / EXP_PER_LEVEL; // Screen->Rectangle(7, EXP_METER_X, EXP_METER_Y, EXP_METER_X + length, EXP_METER_Y + EXP_METER_WIDTH, EXP_METER_COLOR, 1, 0, 0, 0, true, OP_OPAQUE); //} int enemyEXPWorth(npc enem){ return Max(1, enem->Misc[NPC_MISC_MAXHP] / EXP_HP_RATIO); } void giveEXP(int amount){ //Give EXP Game->Counter[CR_XP] += amount; } //Makes Link walk faster in addition to normal walking speed void fastWalk ( int speed ){ //Up if( Link->InputUp && !Screen->isSolid(Link->X,Link->Y+6) //NW && !Screen->isSolid(Link->X+7,Link->Y+6) //N && !Screen->isSolid(Link->X+15,Link->Y+6) //NE ) Link->Y -= speed; //Down else if( Link->InputDown && !Screen->isSolid(Link->X,Link->Y+17) //SW && !Screen->isSolid(Link->X+7,Link->Y+17) //S && !Screen->isSolid(Link->X+15,Link->Y+17) //SE ) Link->Y += speed; //Left else if( Link->InputLeft && !Screen->isSolid(Link->X-2,Link->Y+8) //NW && !Screen->isSolid(Link->X-2,Link->Y+15) //SW ) Link->X -= speed; //Right else if( Link->InputRight && !Screen->isSolid(Link->X+17,Link->Y+8) //NE && !Screen->isSolid(Link->X+17,Link->Y+15) //SE ) Link->X += speed; } bool checkScreenFlag(int flag){ return Screen->Flags[SF_MISC] & (4<NumLWeapons(); i++) { UpdateLWeapon(Screen->LoadLWeapon(i));}} //////////////// //// Update a given LWeapon. void UpdateLWeapon(lweapon lw) { // If the weapon does not have it's source item marked, mark it as // being created by the last item that Link has used. if (lw->Misc[MISC_LWEAPON_ITEM] == 0) { lw->Misc[MISC_LWEAPON_ITEM] = LastItemUsed;}} //////////////// //// Updates the LastItemUsed variable to our best guess at what was //// most recently used. This should be called at the end of the loop, //// right before Waitdraw or Waitframe, because the item marked in //// LastItemUsed isn't actually used until after the Waitdraw or //// Waitframe. void UpdateLastItem() { // Since we don't know which button has priority if both are pressed // at once, cancel the B button press if A has also been pressed // this frame. if (Link->PressA && Link->PressB) {Link->PressB = false;} // If Link is currently in an action where he obviously can't use // items, then ignore his button presses. if (Link->Action != LA_NONE && Link->Action != LA_WALKING) { return;} // Check which button is being pressed, if any. Also check for the // appopriate Jinx. if (Link->PressA && Link->SwordJinx == 0) { LastItemUsed = GetEquipmentA();} else if (Link->PressB && Link->ItemJinx == 0) { LastItemUsed = GetEquipmentB();}} //////////////// //// Return true if the given lweapon is from the given item. bool IsFromItem(lweapon lw, int itemNumber) { return lw->Misc[MISC_LWEAPON_ITEM] == itemNumber;} //////////////// //// Return true if the given lweapon is from the given item class. bool IsFromItemClass(lweapon lw, int itemClass) { itemdata data = Game->LoadItemData(lw->Misc[MISC_LWEAPON_ITEM]); return data->Family == itemClass;} // Cooldown timers for each button. Button presses are cancelled // unless their cooldown timer is <= 0 int Cooldown_ATimer = -1; int Cooldown_BTimer = -1; // Place in the Active script's main loop. void Cooldown_Update() { // Countdown the timers. if (Cooldown_ATimer >= 0) {Cooldown_ATimer--;} if (Cooldown_BTimer >= 0) {Cooldown_BTimer--;} // Block inputs. if (Cooldown_ATimer > 0) { Link->InputA = false; Link->PressA = false;} if (Cooldown_BTimer > 0) { Link->InputB = false; Link->PressB = false;}} //void DropItems(int drop, int loc) { // DropItems(drop, ComboX(loc), ComboY(loc));} // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemSet(int drop, int x, int y) { npc n = CreateNPCAt(DROP_ENEMY_ID, x, y); n->HP = HP_SILENT; n->ItemSet = drop; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemSet(ffc this, int drop) { npc n = CreateNPCAt(DROP_ENEMY_ID, this->X, this->Y); n->HP = HP_SILENT; n->ItemSet = drop; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemExplode(ffc this, int drop) { DropItemSet(this, drop); eweapon explosion = CreateEWeaponAt(EW_BOMBBLAST, this->X, this->Y); //explosion->CollDetection = true; //This is true by default explosion->Damage = 10; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemExplodeBig(ffc this, int drop) { DropItemSet(this, drop); // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { eweapon explosion = CreateEWeaponAt(EW_SBOMBBLAST, this->X, this->Y); //explosion->CollDetection = true; //This is true by default explosion->Damage = 10; } } void XP() { setMaxHP(); checkEnemiesKilled(); tenThousandPlace(); levelSystem(); } ////Counters need to resetat each level. //XP caps out at L15, and counter rolls over.If XP_10K == 1 && XP == 5000 // is the same as if XP == 15000 //or use 2nd counter to 10K place. Every 10K points, increase XP_10K by 1 //and work code to operateon both counters. void tenThousandPlace() { if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 0 ) { Game->Counter[CR_XP] = 1; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 1 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 2 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 3 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 4 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 5 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 6 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 7 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 8 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 9 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 10 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 11 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 12 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 13 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 14 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 15 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 16 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 17 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 18 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 19 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 20 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 21 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 21 && Game->Counter[CR_XP_10K] < 99 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } } void levelSystem() { if ( Game->Counter[CR_LVL] == 0 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 100 ){ Game->Counter[CR_LVL] = 1; Level1(); } } if ( Game->Counter[CR_LVL] == 1 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 150 ) { Game->Counter[CR_LVL] = 2; Level2(); } } if ( Game->Counter[CR_LVL] == 1 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 2; Level2(); } } if ( Game->Counter[CR_LVL] == 2 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 225 ) { Game->Counter[CR_LVL] = 3; Level3(); } } if ( Game->Counter[CR_LVL] == 2 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 3; Level3(); } } if ( Game->Counter[CR_LVL] == 3 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 338 ) { Game->Counter[CR_LVL] = 4; Level4(); } } if ( Game->Counter[CR_LVL] == 3 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 4; Level4(); } } if ( Game->Counter[CR_LVL] == 4 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 507 ) { Game->Counter[CR_LVL] = 5; Level5(); } } if ( Game->Counter[CR_LVL] == 4 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 5; Level5(); } } if ( Game->Counter[CR_LVL] == 5 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 760 ){ Game->Counter[CR_LVL] = 6; Level6(); } } if ( Game->Counter[CR_LVL] == 5 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 6; Level6(); } } if ( Game->Counter[CR_LVL] == 6 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 1140 ){ Game->Counter[CR_LVL] = 7; Level7(); } } if ( Game->Counter[CR_LVL] == 6 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 7; Level7(); } } if ( Game->Counter[CR_LVL] == 7 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 1710 ){ Game->Counter[CR_LVL] = 8; Level8(); } } if ( Game->Counter[CR_LVL] == 7 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 8; Level8(); } } if ( Game->Counter[CR_LVL] == 8 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 2565 ){ Game->Counter[CR_LVL] = 9; Level9(); } } if ( Game->Counter[CR_LVL] == 8 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 9; Level9(); } } if ( Game->Counter[CR_LVL] == 9 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 3848 ){ Game->Counter[CR_LVL] = 10; Level10(); } } if ( Game->Counter[CR_LVL] == 9 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 10; Level10(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 5772 ){ Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 11 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 8658 ){ Game->Counter[CR_LVL] = 12; Level12(); } } if ( Game->Counter[CR_LVL] == 11 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 12; Level12(); } } if ( Game->Counter[CR_LVL] == 12 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP] >= 2987 && Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 13; Level13(); } } if ( Game->Counter[CR_LVL] == 12 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 1 ) { Game->Counter[CR_LVL] = 13; Level13(); } } if ( Game->Counter[CR_LVL] == 13 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 9481 && Game->Counter[CR_XP_10K] > 0) { Game->Counter[CR_LVL] = 14; Level14(); } } if ( Game->Counter[CR_LVL] == 13 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 1 ) { Game->Counter[CR_LVL] = 14; Level14(); } } if ( Game->Counter[CR_LVL] == 14 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 9222 && Game->Counter[CR_XP_10K] > 1 ){ Game->Counter[CR_LVL] = 15; Level15(); } } if ( Game->Counter[CR_LVL] == 14 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 2 ) { Game->Counter[CR_LVL] = 15; Level15(); } } if ( Game->Counter[CR_LVL] == 15 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 3833 && Game->Counter[CR_XP_10K] > 3 ){ Game->Counter[CR_LVL] = 16; Level16(); } } if ( Game->Counter[CR_LVL] == 15 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 4 ) { Game->Counter[CR_LVL] = 16; Level16(); } } if ( Game->Counter[CR_LVL] == 16 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 5750 && Game->Counter[CR_XP_10K] > 5 ){ Game->Counter[CR_LVL] = 17; Level17(); } } if ( Game->Counter[CR_LVL] == 16 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 6 ) { Game->Counter[CR_LVL] = 17; Level17(); } } if ( Game->Counter[CR_LVL] == 17 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 8625 && Game->Counter[CR_XP_10K] > 8 ){ Game->Counter[CR_LVL] = 18; Level18(); } } if ( Game->Counter[CR_LVL] == 17 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 9 ) { Game->Counter[CR_LVL] = 18; Level18(); } } if ( Game->Counter[CR_LVL] == 18 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 7938 && Game->Counter[CR_XP_10K] > 13 ){ Game->Counter[CR_LVL] = 19; Level19(); } } if ( Game->Counter[CR_LVL] == 18 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 14 ) { Game->Counter[CR_LVL] = 19; Level19(); } } if ( Game->Counter[CR_LVL] == 19 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 500 && Game->Counter[CR_XP_10K] > 20 ){ Game->Counter[CR_LVL] = 20; Level20(); } } if ( Game->Counter[CR_LVL] == 19 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 21 ) { Game->Counter[CR_LVL] = 20; Level20(); } } } //////////////////////// /// XP TABLE /////////// //////////////////////// /// 0 = 0 //////// /// 100 = 1 //////// /// 150 = 2 //////// /// 225 = 3 //////// /// 338 = 4 //////// /// 507 = 5 //////// /// 760 = 6 //////// /// 1140 = 7 //////// /// 1710 = 8 //////// /// 2565 = 9 //////// /// 3848 = 10 //////// /// 5772 = 11 //////// /// 8658 = 12 //////// /// 12987 = 13 //////// /// 19481 = 14 //////// /// 29222 = 15 //////// /// 43833 = 16 //////// /// 65750 = 17 //////// /// 98625 = 18 //////// /// 147938 = 19 //////// /// 210500 = 20 //////// ////////////////////////////////////////// //// XP Algorithm //// //// C = Current Base //// //// H = Half Current Base //// //// N = Amount Needed for Next Level //// //// C + H = N //// //// Thus C (100) + H (50) = N (150) //// ////////////////////////////////////////// ///////////////////////// //// Bump Functions //// ///////////////////////// void increaseMP() { int amount = ( rollDie(10) + rollDie(10) + rollDie(10) ); int myst = ( getMystStat() / 2 ); int total = ( amount + myst ); Link->MP += total; Link->MaxMP += total; } void increaseHP() { int amount = ( rollDie(10) + rollDie(10) + rollDie(10) + rollDie(10) + rollDie(10) ); int body = ( getBodyStat() / 2 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } //////////////////////// //// Roll Functions //// //////////////////////// int rollStat() { int r = Rand(1, 6); //specific value of 1-6 set at random; if ( r == 1 ) { int stat = CR_STAT_BODY; return stat; } else if ( r == 2 ) { int stat = CR_STAT_MIND; return stat; } else if ( r == 3 ) { int stat = CR_STAT_LUCK; return stat; } else if ( r == 4 ) { int stat = CR_STAT_MYST; return stat; } else if ( r == 5 ) { int stat = CR_STAT_INFL; return stat; } else if ( r == 6 ) { int stat = CR_STAT_MUSC; return stat; } } int rollDie(int type){ int n = Rand(1, type); return n; } int roll1d4() { int n = Rand(1, 4); return n; } int roll1d6() { int n = Rand(1, 6); return n; } int roll4d6(){ int a = Rand(1, 6); int b = Rand(1, 6); int c = Rand(1, 6); int d = Rand(1, 6); int t = ( a + b + c + d ); return t; } int roll1d8() { int n = Rand(1, 8); return n; } int roll1d10() { int n = Rand(1, 10); return n; } int roll1d12() { int n = Rand(1, 12); return n; } int roll1d20() { int n = Rand(1, 20); return n; } int roll1d50() { int n = Rand(1, 50); return n; } int roll1d100() { int n = Rand(1, 100); return n; } /////////////////////////// /// Statistic Functions /// /////////////////////////// void increaseStat() { int stat = rollStat(); int n = rollDie(6); Game->Counter[stat] += n; } //void setBodyStat(value){ //} // //void setMindStat(value){ //} // //void setLuckStat(value){ //} // //void setMystStat(value){ //} // //void setInflStat(value){ //} // //void setMuscStat(value){ //} //void setStat(stat, value){ //} int getBodyStat(){ int stat = CR_STAT_BODY; return stat; } int getMindStat(){ int stat = CR_STAT_MIND; return stat; } int getLuckStat(){ int stat = CR_STAT_LUCK; return stat; } int getMystStat(){ int stat = CR_STAT_MYST; return stat; } int getInflStat(){ int stat = CR_STAT_INFL; return stat; } int getMuscStat(){ int stat = CR_STAT_MUSC; return stat; } // Using Stats // heavy weapon script particles // discover present slot of item // set int of slot of item for bools // when trying to use the item // if CT_MUSC < x // set other slot to 'hand' until item is changed. // // Use Body to affect HP: // Use Body to set HP at level increases. Use to set HP regen rate. // Use MUSC to set-augment weapon damage, via roll1dX rands. // Use MUSC for ability to move objects. // bracelets increase Musc, as well as activating triggers. // Bracelet / gauntlet takes up a slot. Any combination of two rings, or one ring and one bracelet at one time. // Use Luck to set jinx durations. // Use Myst to set spell damage. // Require Myst of certain value to use some spells. // Ue Mind for Lore skills. // Use Mind for raw (untrained) examination checks. // Create LWeapon that deals damage based on dX rolls. // Is there any way to use MUSC and random damage on swords? // Possibly replace rhe power of the LW_SWORD generated with a sword with a different value? // INF should set the strings used on FFC scripts when conversing. // A higher INF would open up more lines of dialogue. ///////////////////////// //// Level Functions //// ///////////////////////// void Level1() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[1]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); //Increases HP by 4d10 increaseMP(); //Increases MP by 3d10 increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level2() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[2]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level3() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[3]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level4() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[4]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. Game->Generic[GEN_CANSLASH] = 1; //This should occur when gaining this level, and be permanent. //NWS corrups the given-slash technique: placing it on Level5() doesn;t award it until L6 with NWS, so I'm placng it here to adjust for that. //Place sword techniques one level early, to adjust for NWS delays. } void Level5() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[5]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level6() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[6]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level7() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[7]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level8() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[8]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level9() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[9]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level10() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[10]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level11() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[11]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level12() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[12]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level13() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[13]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level14() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[14]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level15() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[15]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level16() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[16]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level17() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[17]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level18() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[18]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level19() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[19]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level20() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[20]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } ////////////////////////////////// /// Wallet & Pockets Functions /// ////////////////////////////////// void noFreeSpace() { if ( noFreeSpace == false ) { noFreeSpace = true; Screen->Message(NO_FREE_SPACE); //This message will be shown to the player one time, setting noFreeSpace to true. //If the player visits a bank, spends money depleting used space, or ptherwise increases space //then this flag is set back to false. The idea is to prevent displaying a message regularly. } else { Game->PlaySound(NO_SPACE_SFX); } } void spaceFreed() { noFreeSpace = false; //This is a global function that resets the noFreeSpace flag,a nd can be called from anywhere. } void checkFreeSpace() { //This fnction should be in your global while true loop. //It ensures that the noFreeSpace flag is reset if the player spends money, or deposits funds, etc. int walletFreeSpace; int pocketFreeSpace; walletFreeSpace = ( totalWalletSpace - Game->Counter[CR_SIZE_COINS_CURRENCY] ); pocketFreeSpace = ( totalPocketSpace - CR_SIZE_COINS_CURRENCY ); if ( walletFreeSpace > 5 ) { noFreeSpace = false; } if ( walletFreeSpace < 5 ){ if (pocketFreeSpace < coinsize ) { noFreeSpace = false; } } } void storeValue(){ int valueStored = Game->Counter[CR_RUPEES]; } void compareValue(){ if ( valueStored <= Game->Counter[CR_RUPEES] ) { noFreeSpace = true; } else { noFreeSpace = false; } } ///////////////////////////////////////////// /// Armour, Swords, and Shields Functions /// ///////////////////////////////////////////// void checkEatenItems() { //Place this in your main while loop, to display messages to the player if an item is eaten. if ( hasShield == false && shieldMessage == false ){ shieldMessage = true; Screen->Message(SHIELD_LOST); } if ( hasSword == false && swordMessage == false ){ swordMessage = true; Screen->Message(SWORD_LOST); } if ( hasArmour == false && swordMessage == false ){ armourMessage = true; Screen->Message(ARMOUR_LOST); } } /////////////////////// /// SKill Functions /// /////////////////////// void LoreCheckGeneric() { int loreBase; loreBase = ( loreSkill * 10 ); int loreTotal = ( loreBase + Game->Counter[CR_STAT_MIND] ); int loreDifference = ( loreTotal - loreBase ); int loreRoll = rollDie(100); bool success; int loreType; int itemToCheck; int location; int level; int skill; if ( loreRoll < loreTotal ) { //Success loreSuccess = 1; } else { //failure loreSuccess = 2; } } void makeLoreCheck(){ if ( loreSuccess == 0 ){ //do this } } void LoreCheckSuccess(bool success, int loreType, int itemToCheck, int location, int level, int skill ){ if ( loreSuccess == 0 ){ //import results from makeLoreCheck. Create a makeLoreCheck command for each item //that can use it, and each site that can use it. } } void loreLevel(){ loreSuccess = 0; //When increasing Lore, or gaining a level, reset this value. } //Possibly, use a function in the while loop with its own ints and bools. //THis function would store the lore check results and the level of the check //for every item. It wouod compare the result (0, 1, 2) to the character level, and the level at the time //that the player made the check. If the currentLevel > lastLevelForCheck, then it will allow a new check. //if the result is 0, it will always allow a check, and if the result is 2, it gives the new item. //This would keep the variables in the scope of the function, instead of as global constants and global vars. void paddle(){ int combo=Screen->ComboT[ComboAt(Link->X+8, Link->Y+12)]; if(combo==CT_WATER || combo==CT_SWIMWARP || combo==CT_DIVEWARP || (combo>=CT_SWIMWARPB && combo<=CT_DIVEWARPD)) { isSwimming = true; } else{ isSwimming = false; } if( Link->Dir == DIR_UP //If Link is facing up... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X,Link->Y+6) //NW && !Screen->isSolid(Link->X+7,Link->Y+6) //N && !Screen->isSolid(Link->X+15,Link->Y+6) //NE ) { Link->Y -= 2; Game->PlaySound(SwimPaddle); } else if( Link->Dir == DIR_DOWN //If Link is facing down... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X,Link->Y+17) //SW && !Screen->isSolid(Link->X+7,Link->Y+17) //S && !Screen->isSolid(Link->X+15,Link->Y+17) //SE ) { Link->Y += 2; Game->PlaySound(SwimPaddle); } if( Link->Dir == DIR_RIGHT //If Link is facing right.... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X+17,Link->Y+8) //NE && !Screen->isSolid(Link->X+17,Link->Y+15) //SE ) { Link->X += 2; Game->PlaySound(SwimPaddle); } if( Link->Dir == DIR_LEFT //If Link is facing left... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X-2,Link->Y+8) //NW && !Screen->isSolid(Link->X-2,Link->Y+15) //SW ) { Link->X -= 2; Game->PlaySound(SwimPaddle); } if ( Link->Action == LA_SWIMMING && isSwimming == false ) { Link->Action = LA_NONE; } } void swordOfLightSwitcher(){ if ( ownSwordOfLight == true && Link->Item[152] == false && Link->MP > 20 ) { Link->Item[152] = true; } else if ( ownSwordOfLight == true && Link->Item[152] == true && Link->MP < 20 ) { Link->Item[152] = false; } } void cigarActive(){ if ( timerItem > 0 ){ if ( Link->Item[timerItem] == false && cigarPickup == true ) { Link->Item[timerItem] = false; cigarPickup = false; Link->MaxHP -= 64; } else if ( Link->Item[timerItem] == true && cigarPickup == false ) { Link->MaxHP += 64; Link->HP += 64; } } } void timedItem(){ if ( timerItem > 0 ) { if ( timerValue > 0 ) { timerValue--; } else if ( timerValue <= 0 && Link->Item[timerItem] == true ) { Link->Item[timerItem] = false; cigarPickup == false; } } } void SET_SCRIPT_DEFENSE(int lw, int npcid, int value){ //ARGUMENTS: Script weapon number, ID of the NPC with the defense, NPC defense type (Use the NPCD_ constants from std.zh) for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc e = Screen->LoadNPC(i); if(e->ID == npcid){ NPC_SCRIPT_DEFENSE[(i*10) + lw] = value; } } } void CLEAR_SCRIPT_DEFENSE(int line){ //Use Screen->LoadNPC with this. Clears the defenses associated with that NPC. for(int i; i<10; i++){ NPC_SCRIPT_DEFENSE[(line*10) + i] = 0; } } void doenemyhit(int m){ float defensemodifier[] = { 1, .5, .25, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 9999 }; for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc e = Screen->LoadNPC(i); for ( int j = Screen->NumLWeapons(); j > 0; j-- ){ lweapon l = Screen->LoadLWeapon(j); TraceB(Collision(l, e)); if(Collision(l, e)){ if(l->ID == LW_ARROW){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_ARROW]]); if ( WSpierce == true ){ l->DeadState = WDS_ALIVE; } else { l->DeadState = WDS_DEAD; } } if(l->ID == LW_BEAM){ int applyDamage; int NPCD_sum = e->Defense[NPCD_BEAM]; applyDamage = NPCD_sum * currentDamage; l->Damage = applyDamage; Trace(applyDamage); if ( WSpierce == true ){ l->DeadState = WDS_ALIVE; } else { l->DeadState = WDS_DEAD; } } if(l->ID == LW_BRANG){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_BRANG]]); l->DeadState = WDS_BOUNCE; } if(l->ID == LW_BOMBBLAST){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_BOMB]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_CANEOFBYRNA){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_BYRNA]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_FIRE || l->ID == LW_SPARKLE){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_FIRE]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_HAMMER){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_HAMMER]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_HOOKSHOT){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_HOOKSHOT]]); l->DeadState = WDS_BOUNCE; } if(l->ID == LW_MAGIC){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_MAGIC]]); if ( WSpierce == true ){ l->DeadState = WDS_ALIVE; } else { l->DeadState = WDS_DEAD; } } if(l->ID == LW_REFBEAM){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_REFBEAM]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_REFMAGIC){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_REFMAGIC]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_REFFIREBALL){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_REFFIREBALL]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_REFROCK){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_REFROCK]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_SBOMBBLAST){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_SBOMB]]); l->DeadState = WDS_DEAD; } if(l->ID == LW_CANEOFBYRNA){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_BYRNA]]); l->DeadState = WDS_DEAD; } if(l->ID >= LW_SCRIPT1 && l->ID <= LW_SCRIPT10){ e->HP -= (l->Misc[m] * NPC_SCRIPT_DEFENSE[(i*10) + (l->ID - 30)]); if ( WSpierce == true ){ l->DeadState = WDS_ALIVE; } else { l->DeadState = WDS_DEAD; } } // if(l->ID == LW_STOMP){ // e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_STOMP]]); // l->DeadState = WDS_DEAD; //LW_STOMP does not exist, and there is no constant for this LW class. Does this class exist, or is this handled by the Link class? // } if(l->ID == LW_SWORD){ int applyDamage; int NPCD_sum = e->Defense[NPCD_SWORD]; applyDamage = NPCD_sum * currentDamage; //lweapon temp(LW_SCRIPT10); //temp->X = l->X; //temp->Y = l->Y; //temp->Damage = currentDamage; //e->HP -= l->Misc[1]; //l->Damage = applyDamage; //l->Damage = l->Misc[1]; //int doDamage = 901; l->Damage = currentDamage; Trace(l->Misc[1]); //Trace(doDamage); l->DeadState = WDS_DEAD; } if(l->ID == LW_WAND){ e->HP -= (l->Misc[m] * defensemodifier[e->Defense[NPCD_WAND]]); l->DeadState = WDS_DEAD; } } } } } void Set_Weapon_Damage(int index){ for(int i = 0; i<40; i++){ if(WeaponCreated[i]){ for(int j = 1; j <= Screen->NumLWeapons(); j++){ lweapon l = Screen->LoadLWeapon(j); //Trace(l->Misc[1]); //if(l->ID == i && l->Misc[1] > 0){ if(l->ID == j){ l->Misc[1] = (currentDamage + 1000); l->Damage = currentDamage; Trace(l->Misc[1]); } } } } } //int diePerLevel(int die, int cap) { // int total; // int level = Game->Counter[CR_LEVEL]; // int rollLevels; // if ( cap > 0 ) { // rollLevels = cap; // } // else { // rollLevels = level; // } // // int dieValue = Rand(1, die); // return dieValue; // // for(int i = 1; i <= rollLevels; i++){ // total += dieValue; // } // return total; //} int diePerLevel(int dieType, int dieCap){ int diceTotal = 0; int level = Game->Counter[CR_LEVEL]; int rollLevels = 0; if ( dieCap > 0 ) { rollLevels = dieCap; } else { rollLevels = level; } for (int dice = 1; dice <= rollLevels; dice++){ int roll = Rand(1, dieType); diceTotal = diceTotal+roll; } return diceTotal; } // int rollDice(int dice, int dietype) { // int total = 0; // // int dieValue = Rand(1, dietype); // // for(int i = 1; i <= dice; i++){ // total += Rand(1, dietype); // } // return total; //} int rollDice(int rollNumber, int dieType){ int diceTotal = 0; for (int dice = 1; dice <= rollNumber; dice++){ int roll = Rand(1, dieType); diceTotal = diceTotal+roll; } return diceTotal; } int rollDiceDW(int rollNumber, int dieType){ int A = 0; int L = 0; int rollTimes = ( rollNumber+ 1 ); //+1, because the loop will end as soon as it is !< rollTimes. do { A += Rand(1,dieType); L ++; } while(L < rollTimes); } int rollDiceII(int dice, int dietype) { int total = 0; for(; dice>0; dice--){ total+=Rand(1, dietype); } return total; } int RollDiceAlucard(int numdice, int dicetype){ int dicetotal = 0; for (int dice = 1; dice <= numdice; dice++){ int roll = Rand(1, dicetype); dicetotal = dicetotal+roll; } return dicetotal; } int rolld4Level(int level) { int total; if ( level == 0 ) { total = ( roll1d4() ); } else if ( level == 1 ) { total = ( roll1d4()); } else if ( level == 2 ) { total = ( roll1d4() + roll1d4() ); } else if ( level == 3 ) { total = ( roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 4 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 5 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 6 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 7 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 8 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 9 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 10 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 11 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 12 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 13 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 14) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 15 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 16 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 17 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 18 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 19 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() ); } else if ( level == 20 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() + roll1d4() ); } else if ( level >= 21 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() + roll1d4() + roll1d4() ); } return total; }