Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE Motor SparkfunAnalogJoystick mbed
Fork of Fire_Mbed_2_0 by
Diff: main.cpp
- Revision:
- 6:b17d76960330
- Parent:
- 5:c920ad0bc875
- Child:
- 7:4c8ad4f91c8b
--- a/main.cpp Tue May 02 23:05:40 2017 +0000 +++ b/main.cpp Wed May 03 03:00:23 2017 +0000 @@ -44,13 +44,14 @@ int y; char passable; tiles(char v1 =0, int x1=0, int y1=0, char p1=0) : v(v1), x(x1), y(y1), passable(p1){}}; //fortress_t,house_t,keep_t,grass_t,trees_t; -const tiles fortress_t(0,x_sector,0x5042,0); -const tiles house_t(1,x_sector,0x5058,1); -const tiles keep_t(2,x_sector,0x5054,1); -const tiles grass_t(3,x_sector,0x5056,1); -const tiles trees_t(4,x_sector,0x5052,1); +const tiles fortress_t(0,x_sector,0x5009,0); +const tiles house_t(1,x_sector,0x5021,1); +const tiles keep_t(2,x_sector,0x501B,1); +const tiles grass_t(3,x_sector,0x501D,1); +const tiles trees_t(4,x_sector,0x5019,1); +const tiles hill_t(5,x_sector,0x501F,1); -tiles tile_array[5] = {fortress_t,house_t,keep_t,grass_t,trees_t}; +tiles tile_array[6] = {fortress_t,house_t,keep_t,grass_t,trees_t,hill_t}; typedef struct units { @@ -95,9 +96,9 @@ static person_t p_Wolf_b; static person_t p_Wolf_c; static person_t p_Assassin_e; -static person_t p_Thief_a; -static person_t p_Thief_b; -static person_t p_Thief_c; +static person_t p_Fighter_a; +static person_t p_Fighter_b; +static person_t p_Fighter_c; static person_t p_RedSpider; static person_t p_Spider_a; static person_t p_Spider_b; @@ -123,7 +124,7 @@ person_t* person_array[42] = {NULL, &p_Princess, &p_Thief, &p_WhiteMage, &p_Pirate, &p_Lancer, &p_Archer, &p_Dragon, &p_Sage, &p_Caster, &p_Assassin, &p_Medic, &p_Brigand, &p_Wolf_a, &p_Wolf_b, &p_Wolf_c, - &p_Assassin_e, &p_Thief_a, &p_Thief_b, &p_Thief_c, + &p_Assassin_e, &p_Fighter_a, &p_Fighter_b, &p_Fighter_c, &p_RedSpider, &p_Spider_a, &p_Spider_b, &p_Spider_c, &p_FallenHero, &p_Mage_4a, &p_Mage_4b, &p_Mage_4c, &p_TrueAssassin, &p_Zombie_5a, &p_Zombie_5b, &p_Zombie_5c, @@ -258,11 +259,59 @@ }*/ //uLCD.set_sector_address(Mapx, Mapy); //uLCD.display_image(0,0); + p_Princess.job = j_Erika; + p_Thief = j_Thief; + p_WhiteMage = j_Cleric; + p_Pirate = j_Pirate; + p_Lancer = j_Knight; + p_Archer = j_Archer; + p_Dragon = j_Myrrh; + p_Sage = j_Sage_M; + p_Caster = j_Sage_F; + p_Assassin = j_Assassin_F; + p_Medic = j_Bard; + p_Brigand = j_Brigand; + p_Wolf_a = j_Wolf; + p_Wolf_b = j_Wolf; + p_Wolf_c = j_Wolf; + p_Assassin_e = j_Boss_Assassin_F; + p_Fighter_a = j_Fighter; + p_Fighter_b = j_Fighter; + p_Fighter_c = j_Fighter; + person_t p_RedSpider = j_RedSpider; + p_Spider_a = j_Spider; + p_Spider_b = j_Spider; + p_Spider_c = j_Spider; + p_FallenHero = j_Hero; + p_Mage_4a = j_Mage; + p_Mage_4b = j_Mage; + p_Mage_4c = j_Mage; + p_TrueAssassin = j_Assassin_M; + p_Zombie_5a = j_Zombie; + p_Zombie_5b = j_Zombie; + p_Zombie_5c = j_Zombie; + p_General = j_General; + p_Zombie_6a = j_Zombie; + p_Zombie_6b = j_Zombie; + p_Mage_6a = j_Mage; + p_Mage_6b = j_Mage; + p_Summoner = j_Summoner; + p_Zombie_7a = j_Zombie; + p_Zombie_7b = j_Zombie; + p_Zombie_7c = j_Zombie; + p_Zombie_7d = j_Zombie; + + + + person_t* temp_person_init; for( char i = 1; i<42; i++){ temp_person_init = person_array[i]; temp_person_init->v = i; temp_person_init->status = 1; + Mc.remain_moves = Mc.job.movement; + temp_person_init->remain_moves = temp_person_init->job->movement; + temp_person_init->health = temp_person_init->job->maxHealth; if (i<=11) temp_person_init->FoF = USER; else @@ -306,16 +355,16 @@ //uLCD.set_sector_address(Ap.job.x, Ap.job.y); //uLCD.display_image((Ap.xloc*16),(Ap.yloc*16)); - Healer.job = j_Cleric; - Healer.v = 4; - Healer.FoF = USER; - Healer.xlast = 0; - Healer.xloc = 0; - Healer.ylast = 3; - Healer.yloc = 3; - Healer.remain_moves = Healer.job.movement; - Healer.health = Healer.job.maxHealth; - +// Healer.job = j_Cleric; +// Healer.v = 4; +// Healer.FoF = USER; +// Healer.xlast = 0; +// Healer.xloc = 0; +// Healer.ylast = 3; +// Healer.yloc = 3; +// Healer.remain_moves = Healer.job.movement; +// Healer.health = Healer.job.maxHealth; +// //uLCD.set_sector_address(Healer.job.x, Healer.job.y); //uLCD.display_image((Healer.xloc*16),(Healer.yloc*16)); @@ -392,6 +441,7 @@ uLCD.printf("Or Continue\r\n"); while(units_received == 0){ waitForAck();} + load_floor(stagenumber); load_units_map(); return; } @@ -752,9 +802,14 @@ int combat(person_t* attacker, person_t* defender){ int d_health; if (attacker->job.attack == magic){ - d_health = (defender->health)-((attacker->job.damage)-(defender->job.defence));} + d_health = (defender->health)-((attacker->job.damage)-(defender->job.defence)); + } + else if (attacker->job.attack == dagger){ + d_health = (defender->health)-((attacker->job.damage)-((defender->job.defence)/2)); + } else{ - d_health = (defender->health)-((attacker->job.damage)-(defender->job.res));} + d_health = (defender->health)-((attacker->job.damage)-(defender->job.res)); + } int a_health; if (d_health < (defender->health)) defender->health = d_health; @@ -1084,6 +1139,7 @@ while (units_received == 0){ waitForAck(); } + load_floor(stageneumber); load_units_map();