Browse Source

defog, healing wish, trick room, magic room, wonder room

SBird1337 8 years ago
parent
commit
b0af1ae2c9

+ 6
- 0
bpre.sym View File

@@ -111,6 +111,12 @@ battle_status_3 = 0x02023DFC;
111 111
 item_get_quality = 0x0809A948|1;
112 112
 item_get_x12 = 0x0809A924|1;
113 113
 
114
+party_player = 0x02024284;
115
+party_opponent = 0x0202402C;
116
+
117
+get_attributes = 0x0803FBE8|1;
118
+set_attributes = 0x0804037C|1;
119
+
114 120
 
115 121
 battle_status3_bits_pbs = 0x02023DFC;
116 122
 

+ 1
- 1
data/moves/animation_table.S View File

@@ -465,7 +465,7 @@ m_animation_table:
465 465
 .word 0x081C6F34 @458
466 466
 .word 0x081C6F34 @459
467 467
 .word 0x081C6F34 @460
468
-.word 0x081C6F34 @461
468
+.word as_lunar_dance @461
469 469
 .word 0x081C6F34 @462
470 470
 .word 0x081C6F34 @463
471 471
 .word 0x081C6F34 @464

+ 4
- 2
data/moves/effect_table.S View File

@@ -30,7 +30,7 @@ m_effect_table:
30 30
 	.word 0x081D6900 @21
31 31
 	.word 0x081D6900 @22
32 32
 	.word 0x081D6C02 @23
33
-	.word 0x081D6C0D @24
33
+	.word bs_defog   @24    Also used for sweet scent
34 34
 	.word 0x081D6C72 @25
35 35
 	.word 0x081D6C83 @26
36 36
 	.word 0x081D6C97 @27
@@ -233,4 +233,6 @@ m_effect_table:
233 233
         .word bs_swap_moves         @224
234 234
         .word bs_punishment         @225
235 235
         .word bs_change_ability     @226
236
-        .word bs_magnet_rise        @227
236
+        .word bs_magnet_rise        @227
237
+        .word bs_rooms              @228
238
+        .word bs_healing_wish       @229

+ 9
- 9
data/moves/move_data.S View File

@@ -435,7 +435,7 @@ move_data_sturzflug:		.byte	198,			120,		2,		100,		15,		0,		0,		0,		51,		0,		0,
435 435
 move_data_erdkraefte:		.byte	72,			90,		4,		100,		10,		10,		0,		0,		50,		0,		1,		0
436 436
 move_data_wechseldich:		.byte	177,			0,		17,		100,		10,		0,		0,		0,		18,		0,		2,		0
437 437
 move_data_gigastoss:		.byte	80,			150,		0,		90,		5,		0,		0,		0,		51,		0,		0,		0
438
-move_data_raenkeschmied:	.byte	MOVE_EFFECT_NONE,	0,		17,		0,		20,		0,		0,		0,		4,		0,		2,		0
438
+move_data_raenkeschmied:	.byte	53,             	0,		17,		0,		20,		0,		0,		0,		4,		0,		2,		0
439 439
 move_data_patronenhieb:		.byte	0,			40,		8,		100,		30,		0,		0,		1,		51,		0,		0,		0
440 440
 move_data_lawine:		.byte	185,			60,		15,		100,		10,		0,		8,		252,		51,		0,		0,		0
441 441
 move_data_eissplitter:		.byte	0,			40,		15,		100,		30,		0,		0,		1,		50,		0,		0,		0
@@ -443,15 +443,15 @@ move_data_dunkelklaue:		.byte	43,			70,		7,		100,		15,		0,		0,		0,		51,		0,		0,
443 443
 move_data_donnerzahn:		.byte	31,             	65,		13,		95,		15,		0,		0,		0,		51,		0,		0,		0
444 444
 move_data_eiszahn:		.byte	31,             	65,		15,		95,		15,		0,		0,		0,		51,		0,		0,		0
445 445
 move_data_feuerzahn:		.byte	31,                     65,		10,		95,		15,		0,		0,		0,		51,		0,		0,		0
446
-move_data_schattenstoss:	.byte	MOVE_EFFECT_NONE,	40,		7,		100,		30,		0,		0,		0,		51,		0,		0,		0
446
+move_data_schattenstoss:	.byte	0,              	40,		7,		100,		30,		0,		0,		0,		51,		0,		0,		0
447 447
 move_data_schlammbombe:		.byte	73,			65,		4,		85,		10,		30,		0,		0,		50,		0,		1,		0
448 448
 move_data_psychoklinge:		.byte	43,			70,		14,		100,		20,		0,		0,		0,		51,		0,		0,		0
449 449
 move_data_zen_kopfstoss:	.byte	31,			80,		14,		90,		15,		0,		0,		0,		51,		0,		0,		0
450 450
 move_data_spiegelsalve:		.byte	73,			65,		8,		85,		10,		30,		0,		0,		50,		0,		1,		0
451 451
 move_data_lichtkanone:		.byte	72,			80,		8,		100,		10,		0,		0,		0,		50,		0,		1,		0
452 452
 move_data_kraxler:		.byte	76,			90,		0,		85,		20,		20,		0,		0,		51,		0,		0,		0
453
-move_data_auflockern:		.byte	MOVE_EFFECT_NONE,	0,		2,		0,		15,		0,		0,		0,		26,		0,		2,		0
454
-move_data_bizarroraum:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		5,		0,		16,		0,		0,		0,		2,		0
453
+move_data_auflockern:		.byte	24,             	0,		2,		100,		15,		0,		0,		0,		26,		0,		2,		0
454
+move_data_bizarroraum:		.byte	228,            	0,		14,		0,		5,		0,		16,		0,		0,		0,		2,		0
455 455
 move_data_draco_meteor:		.byte	204,			130,		16,		90,		5,		0,		0,		0,		50,		0,		1,		0
456 456
 move_data_ladungsstoss:		.byte	6,			80,		13,		100,		15,		30,		32,		0,		50,		0,		1,		0
457 457
 move_data_flammensturm:		.byte	4,			80,		10,		100,		15,		30,		32,		0,		50,		0,		1,		0
@@ -464,7 +464,7 @@ move_data_eisenschaedel:	.byte	31,			80,		8,		100,		15,		30,		0,		0,		51,		0,		0
464 464
 move_data_magnetbombe:		.byte	17,			60,		8,		0,		20,		0,		0,		0,		50,		0,		0,		0
465 465
 move_data_steinkante:		.byte	43,			100,		5,		80,		5,		0,		0,		0,		50,		0,		0,		0
466 466
 move_data_liebreiz:		.byte	MOVE_EFFECT_NONE,	0,		0,		100,		20,		0,		0,		0,		26,		0,		2,		0
467
-move_data_tarnsteine:		.byte	MOVE_EFFECT_NONE,	0,		5,		0,		20,		0,		64,		0,		8,		0,		2,		0
467
+move_data_tarnsteine:		.byte	112,                	0,		5,		0,		20,		0,		64,		0,		8,		0,		2,		0
468 468
 move_data_strauchler:		.byte	196,			1,		12,		100,		20,		0,		0,		0,		51,		0,		1,		0
469 469
 move_data_geschwaetz:		.byte	76,			65,		2,		100,		20,		100,		0,		0,		50,		0,		1,		0
470 470
 move_data_urteilskraft:		.byte	MOVE_EFFECT_NONE,	100,		0,		100,		10,		0,		0,		0,		50,		0,		1,		0
@@ -479,8 +479,8 @@ move_data_kopfstoss:		.byte	198,			150,		5,		80,		5,		0,		0,		0,		51,		0,		0,		0
479 479
 move_data_doppelschlag:		.byte	44,			35,		0,		90,		10,		0,		0,		0,		51,		0,		0,		0
480 480
 move_data_zeitenlaerm:		.byte	80,			150,		16,		90,		5,		0,		0,		0,		50,		0,		1,		0
481 481
 move_data_raumschlag:		.byte	43,			100,		16,		95,		5,		0,		0,		0,		51,		0,		1,		0
482
-move_data_lunartanz:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		10,		0,		0,		0,		0,		0,		2,		0
483
-move_data_quetschgriff:		.byte	MOVE_EFFECT_NONE,	120,		0,		100,		5,		0,		0,		0,		51,		0,		0,		0
482
+move_data_lunartanz:		.byte	229,            	0,		14,		0,		10,		0,		0,		0,		0,		0,		2,		0
483
+move_data_quetschgriff:		.byte	220,            	120,		0,		100,		5,		0,		0,		0,		51,		0,		0,		0
484 484
 move_data_lavasturm:		.byte	42,			100,		10,		75,		5,		100,		0,		0,		50,		0,		1,		0
485 485
 move_data_schlummerort:		.byte	1,			0,		17,		80,		10,		100,		8,		0,		26,		0,		2,		0
486 486
 move_data_schocksamen:		.byte	MOVE_EFFECT_NONE,	120,		12,		85,		5,		40,		0,		0,		50,		0,		1,		0
@@ -490,13 +490,13 @@ move_data_klauenwetzer:		.byte	MOVE_EFFECT_NONE,	0,		17,		0,		15,		0,		16,		0,
490 490
 move_data_rundumschutz:		.byte	MOVE_EFFECT_NONE,	0,		5,		0,		10,		0,		16,		3,		0,		0,		2,		0
491 491
 move_data_schutzteiler:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
492 492
 move_data_kraftteiler:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
493
-move_data_wunderraum:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
493
+move_data_wunderraum:		.byte	228,                	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
494 494
 move_data_psychoschock:		.byte	MOVE_EFFECT_NONE,	80,		14,		100,		10,		0,		0,		0,		50,		0,		1,		0
495 495
 move_data_giftschock:		.byte	MOVE_EFFECT_NONE,	65,		3,		100,		10,		0,		0,		0,		50,		0,		1,		0
496 496
 move_data_autotomie:		.byte	MOVE_EFFECT_NONE,	0,		8,		0,		15,		0,		0,		0,		4,		0,		2,		0
497 497
 move_data_wutpulver:		.byte	172,			0,		6,		0,		20,		0,		16,		2,		0,		0,		2,		0
498 498
 move_data_telekinese:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		15,		0,		0,		0,		26,		0,		2,		0
499
-move_data_magieraum:		.byte	MOVE_EFFECT_NONE,	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
499
+move_data_magieraum:		.byte	228,                	0,		14,		0,		10,		0,		16,		0,		0,		0,		2,		0
500 500
 move_data_katapult:		.byte	MOVE_EFFECT_NONE,	50,		5,		100,		15,		0,		0,		0,		50,		0,		0,		0
501 501
 move_data_bergsturm:		.byte	MOVE_EFFECT_NONE,	60,		1,		100,		10,		0,		0,		0,		51,		0,		0,		0
502 502
 move_data_funkenflug:		.byte	MOVE_EFFECT_NONE,	70,		10,		100,		15,		0,		8,		0,		50,		0,		1,		0

+ 2
- 2
data/pkmn_tables/pokemon_moveset_table.S View File

@@ -1218,9 +1218,9 @@ moveset_bisasam:
1218 1218
 .byte 0x1 
1219 1219
 .hword MOVE_HOWL 
1220 1220
 .byte 0x3 
1221
-.hword MOVE_MAGNET_RISE
1221
+.hword MOVE_LUNAR_DANCE
1222 1222
 .byte 0x7 
1223
-.hword MOVE_HYPNOSIS
1223
+.hword MOVE_WONDER_ROOM
1224 1224
 .byte 0x7
1225 1225
 .hword 0x4D 
1226 1226
 .byte 0xD 

+ 33
- 0
nbproject/configurations.xml View File

@@ -4627,6 +4627,7 @@
4627 4627
           <in>debug.h</in>
4628 4628
           <in>item_effects.h</in>
4629 4629
           <in>items.h</in>
4630
+          <in>pkmn_attributes.h</in>
4630 4631
           <in>pokemon.h</in>
4631 4632
         </df>
4632 4633
         <df name="interface">
@@ -4674,6 +4675,10 @@
4674 4675
             <in>crush_grip_like_script.S</in>
4675 4676
             <in>hp_damage_mod.c</in>
4676 4677
           </df>
4678
+          <df name="defog">
4679
+            <in>defog.c</in>
4680
+            <in>defog_script.S</in>
4681
+          </df>
4677 4682
           <df name="fang_moves">
4678 4683
             <in>fang_animations.S</in>
4679 4684
             <in>fang_effect.S</in>
@@ -4692,6 +4697,10 @@
4692 4697
           <df name="hazards">
4693 4698
             <in>hazards_scripts.S</in>
4694 4699
           </df>
4700
+          <df name="healing_wish">
4701
+            <in>healing_wish.c</in>
4702
+            <in>healing_wish_script.S</in>
4703
+          </df>
4695 4704
           <df name="lucky_chant">
4696 4705
             <in>lucky_chant.c</in>
4697 4706
             <in>lucky_chant_script.S</in>
@@ -4716,6 +4725,10 @@
4716 4725
             <in>punishment.c</in>
4717 4726
             <in>punishment_script.S</in>
4718 4727
           </df>
4728
+          <df name="rooms">
4729
+            <in>rooms.c</in>
4730
+            <in>rooms_script.S</in>
4731
+          </df>
4719 4732
           <df name="roost">
4720 4733
             <in>roost.c</in>
4721 4734
             <in>roost_scripts.S</in>
@@ -27341,6 +27354,8 @@
27341 27354
       </item>
27342 27355
       <item path="src/include/items.h" ex="false" tool="3" flavor2="0">
27343 27356
       </item>
27357
+      <item path="src/include/pkmn_attributes.h" ex="false" tool="3" flavor2="0">
27358
+      </item>
27344 27359
       <item path="src/include/pokemon.h" ex="false" tool="3" flavor2="0">
27345 27360
       </item>
27346 27361
       <item path="src/interface/lcd_io_test.S" ex="false" tool="4" flavor2="0">
@@ -27437,6 +27452,10 @@
27437 27452
             tool="0"
27438 27453
             flavor2="0">
27439 27454
       </item>
27455
+      <item path="src/moves/defog/defog.c" ex="false" tool="0" flavor2="0">
27456
+      </item>
27457
+      <item path="src/moves/defog/defog_script.S" ex="false" tool="4" flavor2="0">
27458
+      </item>
27440 27459
       <item path="src/moves/fang_moves/fang_animations.S"
27441 27460
             ex="false"
27442 27461
             tool="4"
@@ -27468,6 +27487,16 @@
27468 27487
             tool="4"
27469 27488
             flavor2="0">
27470 27489
       </item>
27490
+      <item path="src/moves/healing_wish/healing_wish.c"
27491
+            ex="false"
27492
+            tool="0"
27493
+            flavor2="0">
27494
+      </item>
27495
+      <item path="src/moves/healing_wish/healing_wish_script.S"
27496
+            ex="false"
27497
+            tool="4"
27498
+            flavor2="0">
27499
+      </item>
27471 27500
       <item path="src/moves/lucky_chant/lucky_chant.c"
27472 27501
             ex="false"
27473 27502
             tool="0"
@@ -27522,6 +27551,10 @@
27522 27551
             tool="4"
27523 27552
             flavor2="0">
27524 27553
       </item>
27554
+      <item path="src/moves/rooms/rooms.c" ex="false" tool="0" flavor2="0">
27555
+      </item>
27556
+      <item path="src/moves/rooms/rooms_script.S" ex="false" tool="4" flavor2="0">
27557
+      </item>
27525 27558
       <item path="src/moves/roost/roost.c" ex="false" tool="0" flavor2="0">
27526 27559
       </item>
27527 27560
       <item path="src/moves/roost/roost_scripts.S" ex="false" tool="4" flavor2="0">

+ 19
- 0
nbproject/private/configurations.xml View File

@@ -4059,6 +4059,8 @@
4059 4059
             </df>
4060 4060
             <df name="crush_grip_like">
4061 4061
             </df>
4062
+            <df name="defog">
4063
+            </df>
4062 4064
             <df name="fang_moves">
4063 4065
             </df>
4064 4066
             <df name="feint">
@@ -4069,6 +4071,8 @@
4069 4071
             </df>
4070 4072
             <df name="hazards">
4071 4073
             </df>
4074
+            <df name="healing_wish">
4075
+            </df>
4072 4076
             <df name="lucky_chant">
4073 4077
             </df>
4074 4078
             <df name="magnet_rise">
@@ -4081,6 +4085,8 @@
4081 4085
             </df>
4082 4086
             <df name="punishment">
4083 4087
             </df>
4088
+            <df name="rooms">
4089
+            </df>
4084 4090
             <df name="roost">
4085 4091
             </df>
4086 4092
             <df name="swap_moves">
@@ -5797,6 +5803,7 @@
5797 5803
           <in>lcd.h</in>
5798 5804
           <in>moves.h</in>
5799 5805
           <in>objects.h</in>
5806
+          <in>pkmn_attributes.h</in>
5800 5807
           <in>pkmn_types.h</in>
5801 5808
           <in>pokemon.h</in>
5802 5809
           <in>sound.h</in>
@@ -5847,6 +5854,10 @@
5847 5854
             <in>crush_grip_like_script.S</in>
5848 5855
             <in>hp_damage_mod.c</in>
5849 5856
           </df>
5857
+          <df name="defog">
5858
+            <in>defog.c</in>
5859
+            <in>defog_script.S</in>
5860
+          </df>
5850 5861
           <df name="fang_moves">
5851 5862
             <in>fang_animations.S</in>
5852 5863
             <in>fang_effect.S</in>
@@ -5865,6 +5876,10 @@
5865 5876
           <df name="hazards">
5866 5877
             <in>hazards_scripts.S</in>
5867 5878
           </df>
5879
+          <df name="healing_wish">
5880
+            <in>healing_wish.c</in>
5881
+            <in>healing_wish_script.S</in>
5882
+          </df>
5868 5883
           <df name="lucky_chant">
5869 5884
             <in>lucky_chant.c</in>
5870 5885
             <in>lucky_chant_script.S</in>
@@ -5889,6 +5904,10 @@
5889 5904
             <in>punishment.c</in>
5890 5905
             <in>punishment_script.S</in>
5891 5906
           </df>
5907
+          <df name="rooms">
5908
+            <in>rooms.c</in>
5909
+            <in>rooms_script.S</in>
5910
+          </df>
5892 5911
           <df name="roost">
5893 5912
             <in>roost.c</in>
5894 5913
             <in>roost_scripts.S</in>

+ 16
- 0
src/battle_engine/battle_help.c View File

@@ -119,4 +119,20 @@ u8 cant_poison(u8 bank, u8 self_inflicted) { //0 == can poison
119 119
     if (side_affecting_halfword[get_side_from_bank(bank)].safeguard_on && !self_inflicted)
120 120
         return 5;
121 121
     return 0;
122
+}
123
+
124
+u8 count_party_pokemon(u8 bank)
125
+{
126
+    struct pokemon* poke;
127
+    if (get_side_from_bank(bank))
128
+        poke = &party_opponent[0];
129
+    else
130
+        poke = &party_player[0];
131
+    u8 usable_pokes = 0;
132
+    for (u8 i = 0; i < 6; i ++)
133
+    {
134
+        if (get_attributes(&poke[i], ATTR_CURRENT_HP, 0) != 0 && get_attributes(&poke[i], ATTR_IS_EGG, 0) != 1 && get_attributes(&poke[i], ATTR_SPECIES, 0) != 0)
135
+            usable_pokes++;
136
+    }
137
+    return usable_pokes;
122 138
 }

+ 1
- 0
src/battle_engine/custom_structs_malloc.c View File

@@ -44,6 +44,7 @@ void battle_switch_in()
44 44
             *def = switch_var;
45 45
         }
46 46
     }
47
+    
47 48
     struct side_affecting* active_side = &custom_battle_elements.ptr->side_affecting[get_side_from_bank(battle_active_bank)];
48 49
     active_side->stealth_rock_done = 0;
49 50
     active_side->sticky_web_done = 0;

+ 18
- 3
src/battle_engine/entry_hazards.c View File

@@ -12,11 +12,27 @@ extern void* bs_rocks_lain;
12 12
 extern void* bs_toxic_lain;
13 13
 extern void* bs_sticky_lain;
14 14
 
15
+extern void* bs_lunar_dance_exec;
16
+
17
+extern void* str_lunardance_executed_ref;
18
+
15 19
 u8 execute_entry_hazards() {
16 20
     u8 active_side = get_side_from_bank(battle_active_bank);
17 21
     u8 has_effect = 0;
18 22
     struct side_affecting* active_side_affecting = &custom_battle_elements.ptr->side_affecting[active_side];
19
-    if (side_affecting_halfword[active_side].spikes_on && !(side_affecting_halfword[active_side].spikes_damage_done)) {
23
+    if (active_side_affecting->lunardance && !(active_side_affecting->lunardance_done)) {
24
+        battle_damage_store = ((s32)battle_participants[battle_active_bank].max_hp - (s32)battle_participants[battle_active_bank].current_hp) * -1;
25
+        active_side_affecting->lunardance = 0;
26
+        
27
+        battle_participants[battle_active_bank].status.int_status = 0;
28
+        prepare_setattributes_in_battle(0, REQUEST_STATUS_BATTLE, 0, 4, &battle_participants[battle_active_bank].status);
29
+        mark_buffer_bank_for_execution(battle_active_bank);
30
+        
31
+        battle_script_push();
32
+        battle_string_chooser = str_lunardance_executed_ref;
33
+        battlescript_cursor = bs_lunar_dance_exec;
34
+        has_effect = 1;
35
+    } else if (side_affecting_halfword[active_side].spikes_on && !(side_affecting_halfword[active_side].spikes_damage_done)) {
20 36
         //spikes lay down, deal spiky damage
21 37
         u32 damage = (battle_participants[battle_active_bank].max_hp) / ((5 - battle_side_timers[active_side].spikes_amount) * 2);
22 38
         if (damage == 0)
@@ -68,8 +84,7 @@ u8 execute_entry_hazards() {
68 84
                 battle_participants[battle_active_bank].status.flags.toxic_poison = 1;
69 85
                 battle_script_push();
70 86
                 battlescript_cursor = bs_toxic_spikes_bad;
71
-            }
72
-            else {
87
+            } else {
73 88
                 battle_participants[battle_active_bank].status.flags.poison = 1;
74 89
                 battle_script_push();
75 90
                 battlescript_cursor = bs_toxic_spikes;

+ 1
- 0
src/include/battle_help.h View File

@@ -9,4 +9,5 @@ u16 apply_type_effectiveness(u16 chained_effect, u8 move_type, u8 target_bank, u
9 9
 u16 type_effectiveness_calc(u16 move, u8 move_type, u8 atk_bank, u8 def_bank, u8 effects_handling_and_recording);
10 10
 u8 has_type(u8 bank, u8 type);
11 11
 u8 cant_poison(u8 bank, u8 self_inflicted);
12
+u8 count_party_pokemon(u8 bank);
12 13
 #endif

+ 1
- 1
src/include/battle_locations.h View File

@@ -9,7 +9,7 @@ u16 battle_executed_move;
9 9
 u8 battle_attacker_bank;
10 10
 u8 battle_defender_bank;
11 11
 u8 battle_damage_multiplier;
12
-u16 battle_damage_store;
12
+s32 battle_damage_store;
13 13
 u32 battle_hitmarker;
14 14
 void* battlescript_cursor;
15 15
 u8 battle_menu_chosen_item[4];

+ 4
- 4
src/include/battle_script.h View File

@@ -173,11 +173,11 @@
173 173
 .word \jumpifstatus_address
174 174
 .endm
175 175
 
176
-.macro jumpifsecondarytstatus jumpifsecondarytstatus_bank jumpifsecondarytstatus_status jumpifsecondarytstatus_address
176
+.macro jumpifsecondarystatus jumpifsecondarystatus_bank jumpifsecondarystatus_status jumpifsecondarystatus_address
177 177
 .byte 0x1D
178
-.byte \jumpifsecondarytstatus_bank
179
-.word \jumpifsecondarytstatus_status
180
-.word \jumpifsecondarytstatus_address
178
+.byte \jumpifsecondarystatus_bank
179
+.word \jumpifsecondarystatus_status
180
+.word \jumpifsecondarystatus_address
181 181
 .endm
182 182
 
183 183
 .macro jumpifability jumpifability_bank jumpifability_ability jumpifability_address

+ 25
- 0
src/include/battle_structs.h View File

@@ -104,6 +104,31 @@ struct iv_set
104 104
     u32 iv_sp_def: 5;
105 105
 };
106 106
 
107
+struct pokemon{
108
+	u32 PID;
109
+	u32 OTID;
110
+	char name[10];
111
+	u16 language;
112
+	u8 OT_name[7];
113
+	u8 markings;
114
+	u16 checksum;
115
+	u16 padding_maybe;
116
+	u8 data[48];
117
+	u32 ailment;
118
+	u8 level;
119
+	u8 pokerus;
120
+	u16 current_hp;
121
+	u16 total_hp;
122
+	u16 attack;
123
+	u16 defense;
124
+	u16 speed;
125
+	u16 sp_attack;
126
+	u16 sp_defense;
127
+};
128
+
129
+extern struct pokemon party_opponent[6];
130
+extern struct pokemon party_player[6];
131
+
107 132
 struct battle_participant {
108 133
     u16 poke_species;
109 134
     u16 atk;

+ 5
- 0
src/include/bpre.h View File

@@ -7,6 +7,7 @@
7 7
 #include "lcd.h"
8 8
 #include <callback.h>
9 9
 #include <config.h>
10
+#include <pkmn_attributes.h>
10 11
 
11 12
 u32 __aeabi_uidivmod(u32 a, u32 b);
12 13
 u16 *var_access(int index);
@@ -39,4 +40,8 @@ void obj_sync();
39 40
 //task related stuff
40 41
 void task_exec();
41 42
 
43
+//attribute setter and getter
44
+u8 get_attributes(struct pokemon* poke_address, u8 request, void* destination);
45
+void set_attributes(struct pokemon* poke_address, u8 request, void* new_value);
46
+
42 47
 #endif

+ 62
- 0
src/include/pkmn_attributes.h View File

@@ -0,0 +1,62 @@
1
+#ifndef PKMN_ATTRIBUTES_H
2
+#define PKMN_ATTRIBUTES_H
3
+
4
+#define ATTR_PID 0x0
5
+#define ATTR_TID 0x1
6
+#define ATTR_NAME 0x2
7
+#define ATTR_FONT_LANG 0x3
8
+#define ATTR_SANITY 0x4
9
+#define ATTR_OT_NAME 0x7
10
+#define ATTR_MARKS 0x8
11
+#define ATTR_CHECKSUM 0x9
12
+#define ATTR_SPECIES 0xB
13
+#define ATTR_HELD_ITEM 0xC
14
+#define ATTR_ATTACK_1 0xD
15
+#define ATTR_ATTACK_2 0xE
16
+#define ATTR_ATTACK_3 0xF
17
+#define ATTR_ATTACK_4 0x10
18
+#define ATTR_PP_1 0x11
19
+#define ATTR_PP_2 0x12
20
+#define ATTR_PP_3 0x13
21
+#define ATTR_PP_4 0x14
22
+#define ATTR_PP_BONUS 0x15
23
+#define ATTR_COOLNESS 0x16
24
+#define ATTR_BEAUTY 0x17
25
+#define ATTR_CUTENESS 0x18
26
+#define ATTR_EXP 0x19
27
+#define ATTR_HP_EV 0x1A
28
+#define ATTR_ATTACK_EV 0x1B
29
+#define ATTR_DEFENCE_EV 0x1C
30
+#define ATTR_SPEED_EV 0x1D
31
+#define ATTR_SP_ATTACK_EV 0x1E
32
+#define ATTR_SP_DEFENCE_EV 0x1F
33
+#define ATTR_HAPPINESS 0x20
34
+#define ATTR_SMARTNESS 0x21
35
+#define ATTR_POKERUS 0x22
36
+#define ATTR_CATCH_LOCATION 0x23
37
+#define ATTR_CATCH_LVL 0x24
38
+#define ATTR_HP_IV 0x27
39
+#define ATTR_ATTACK_IV 0x28
40
+#define ATTR_DEFENCE_IV 0x29
41
+#define ATTR_SPEED_IV 0x2A
42
+#define ATTR_SPECIAL_ATTACK_IV 0x2B
43
+#define ATTR_SPECIAL_DEFENCE_IV 0x2C
44
+#define ATTR_IS_EGG 0x2D
45
+#define ATTR_ABILITY_BIT 0x2E
46
+#define ATTR_TOUGHNESS 0x2F
47
+#define ATTR_SHEEN 0x30
48
+#define ATTR_STATUS_AILMENT 0x37
49
+#define ATTR_LEVEL 0x38
50
+#define ATTR_CURRENT_HP 0x39
51
+#define ATTR_TOTAL_HP 0x3A
52
+#define ATTR_ATTACK 0x3B
53
+#define ATTR_DEFENCE 0x3C
54
+#define ATTR_SPEED 0x3D
55
+#define ATTR_SPECIAL_ATTACK 0x3E
56
+#define ATTR_SPECIAL_DEFENCE 0x3F
57
+#define ATTR_SPECIES_2 0x41
58
+
59
+
60
+
61
+#endif /* PKMN_ATTRIBUTES_H */
62
+

+ 40
- 0
src/moves/defog/defog.c View File

@@ -0,0 +1,40 @@
1
+#include <battle.h>
2
+
3
+u8 defog_field()
4
+{
5
+    u8 side_defender = get_side_from_bank(battle_defender_bank);
6
+    u8 side_attacker = get_side_from_bank(battle_attacker_bank);
7
+    
8
+    side_affecting_halfword[side_defender].light_screen_on = false;
9
+    side_affecting_halfword[side_defender].reflect_on = false;
10
+    side_affecting_halfword[side_defender].mist_on = false;
11
+    side_affecting_halfword[side_defender].spikes_on = false;
12
+    side_affecting_halfword[side_defender].safeguard_on = false;
13
+    
14
+    side_affecting_halfword[side_attacker].safeguard_on = false;
15
+    side_affecting_halfword[side_attacker].mist_on = false;
16
+    side_affecting_halfword[side_attacker].spikes_on = false;
17
+    
18
+    battle_side_timers[side_defender].lightscreen_timer = 0;
19
+    battle_side_timers[side_defender].reflect_timer = 0;
20
+    
21
+    battle_side_timers[side_defender].mist_timer = 0;
22
+    battle_side_timers[side_defender].safeguard_timer = 0;
23
+    battle_side_timers[side_defender].spikes_amount = 0;
24
+    
25
+    battle_side_timers[side_attacker].mist_timer = 0;
26
+    battle_side_timers[side_attacker].safeguard_timer = 0;
27
+    battle_side_timers[side_attacker].spikes_amount = 0;
28
+    
29
+    custom_battle_elements.ptr->side_affecting[side_attacker].stealth_rock = false;
30
+    custom_battle_elements.ptr->side_affecting[side_attacker].sticky_web = false;
31
+    custom_battle_elements.ptr->side_affecting[side_attacker].toxic_spikes_psn = false;
32
+    custom_battle_elements.ptr->side_affecting[side_attacker].toxic_spikes_badpsn = false;
33
+    
34
+    custom_battle_elements.ptr->side_affecting[side_defender].stealth_rock = false;
35
+    custom_battle_elements.ptr->side_affecting[side_defender].sticky_web = false;
36
+    custom_battle_elements.ptr->side_affecting[side_defender].toxic_spikes_psn = false;
37
+    custom_battle_elements.ptr->side_affecting[side_defender].toxic_spikes_badpsn = false;
38
+    
39
+    return false;
40
+}

+ 25
- 0
src/moves/defog/defog_script.S View File

@@ -0,0 +1,25 @@
1
+#include <battle_script.h>
2
+#include <moves.h>
3
+
4
+.align 2
5
+.thumb
6
+.text
7
+
8
+.global bs_defog
9
+bs_defog:
10
+    setbyte 0x2023FDE 0x97
11
+    attackcanceler
12
+    jumpifsecondarystatus 0x0 0x1000000 0x81D7DF0
13
+    accuracycheck 0x81D695E 0x0
14
+    attackstring
15
+    ppreduce
16
+    jumpifhalfword 0x0 0x2023D4A MOVE_SWEET_SCENT no_defog
17
+    callasm defog_field+1
18
+no_defog:
19
+    statbuffchange 0x1 0x81D6C5D
20
+    jumpifbyte 0x3 0x2023E87 0x2 0x81D6C4B
21
+    jumpifbyte 0x0 0x2023E87 0x3 0x81D6C5D
22
+    pause 0x20
23
+    goto 0x81D6C55
24
+
25
+

+ 17
- 0
src/moves/healing_wish/healing_wish.c View File

@@ -0,0 +1,17 @@
1
+#include <battle.h>
2
+#include <battle_help.h>
3
+
4
+u8 set_healing_wish() {
5
+    if (count_party_pokemon(battle_attacker_bank) <= 1) {
6
+        //it will fail
7
+        battlescript_cursor = (void*) (0x081D7DF0);
8
+        return true;
9
+    } else {
10
+        u8 user_side = get_side_from_bank(battle_attacker_bank);
11
+        custom_battle_elements.ptr->side_affecting[user_side].lunardance = true;
12
+        battle_damage_store = battle_participants[battle_attacker_bank].current_hp;
13
+        battle_hitmarker |= 0x100; //No substitute, only glory in death!
14
+        return false;
15
+    }
16
+    return false;
17
+}

+ 48
- 0
src/moves/healing_wish/healing_wish_script.S View File

@@ -0,0 +1,48 @@
1
+#include <battle_script.h>
2
+
3
+.align 2
4
+.thumb
5
+.text
6
+
7
+.global bs_healing_wish
8
+bs_healing_wish:
9
+
10
+    attackcanceler
11
+    attackstring
12
+    ppreduce
13
+    callasm set_healing_wish+1
14
+    attackanimation
15
+    waitanimation
16
+    graphicalhpupdate 1
17
+    datahpupdate 1
18
+    faintpokemon 1 0 0
19
+    setbyte 0x2023FD8 0x0
20
+    cmd49 0x0 0x0
21
+    end
22
+
23
+bs_lunar_dance_exec_int:
24
+    orword 0x2023DD0 0x100100    
25
+    graphicalhpupdate 1
26
+    datahpupdate 1
27
+    printstring 0x184
28
+    waitmessage 0x40
29
+    cmd98 0x0
30
+    setbyte 0x02023FD8 0
31
+    cmd49 0 0
32
+    return
33
+
34
+.align 2
35
+.global bs_lunar_dance_exec
36
+bs_lunar_dance_exec:
37
+    .word bs_lunar_dance_exec_int
38
+
39
+.global as_lunar_dance
40
+as_lunar_dance:
41
+    .byte 0x00, 0xD2, 0x27, 0x00, 0xD3, 0x27, 0x00, 0x2F, 0x27, 0x0C, 0x00, 0x10, 0x02, 0x24, 0x7B, 0x3E, 0x08, 0x02, 0x05, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x05, 0x02, 0x34
42
+    .byte 0x37, 0x3E, 0x08, 0x02, 0x02, 0x78, 0x00, 0x38, 0x00, 0x03, 0x49, 0x60, 0x07, 0x08, 0x03, 0x05, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x19, 0xCC, 0x00, 0x00, 0x04, 0x1E
43
+    .byte 0x02, 0x64, 0x37, 0x3E, 0x08, 0x28, 0x02, 0xF4, 0xFF, 0x00, 0x00, 0x04, 0x1E, 0x02, 0x64, 0x37, 0x3E, 0x08, 0x28, 0x02, 0xE8, 0xFF, 0x00, 0x00, 0x04, 0x1E, 0x02, 0x64, 0x37, 0x3E, 0x08, 0x28
44
+    .byte 0x02, 0x15, 0x00, 0x00, 0x00, 0x04, 0x1E, 0x02, 0x64, 0x37, 0x3E, 0x08, 0x28, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1E, 0x02, 0x64, 0x37, 0x3E, 0x08, 0x28, 0x02, 0x0A, 0x00, 0x00, 0x00, 0x04
45
+    .byte 0x14, 0x03, 0xC1, 0x5F, 0x0A, 0x08, 0x02, 0x00, 0x05, 0x0A, 0x02, 0x0C, 0x0C, 0x08, 0x03, 0x7D, 0x90, 0x09, 0x08, 0x02, 0x05, 0x00, 0x00, 0x18, 0x00, 0x06, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03
46
+    .byte 0x99, 0xAB, 0x0B, 0x08, 0x02, 0x04, 0x00, 0x00, 0x04, 0x00, 0x07, 0x00, 0x0A, 0x00, 0x19, 0x80, 0x00, 0xC0, 0x04, 0x0C, 0x19, 0x80, 0x00, 0xC0, 0x04, 0x0C, 0x19, 0x80, 0x00, 0xC0, 0x04, 0x0C
47
+    .byte 0x19, 0x80, 0x00, 0xC0, 0x04, 0x0C, 0x19, 0x80, 0x00, 0xC0, 0x04, 0x0C, 0x05, 0x0B, 0x02, 0x0D, 0x04, 0x01, 0x08
48
+

+ 2
- 1
src/moves/punishment/punishment.c View File

@@ -9,7 +9,8 @@ u8 punishment_damage_mod() {
9 9
             (defender->sp_atk_buff > 6 ? defender->sp_atk_buff - 6 : 0) +
10 10
             (defender->sp_def_buff > 6 ? defender->sp_def_buff - 6 : 0) +
11 11
             (defender->spd_buff > 6 ? defender->spd_buff - 6 : 0) +
12
-            (defender->evasion_buff > 6 ? defender->evasion_buff - 6 : 0);
12
+            (defender->evasion_buff > 6 ? defender->evasion_buff - 6 : 0) +
13
+            (defender->acc_buff > 6 ? defender->acc_buff - 6 : 0);
13 14
 
14 15
     battle_base_power = 60 + (status_count * 20);
15 16
     if (battle_base_power > 200)

+ 42
- 0
src/moves/rooms/rooms.c View File

@@ -0,0 +1,42 @@
1
+#include <battle.h>
2
+
3
+extern void* str_trick_room_off_ref;
4
+extern void* str_trick_room_on_ref;
5
+extern void* str_magic_room_off_ref;
6
+extern void* str_magic_room_on_ref;
7
+extern void* str_wonder_room_off_ref;
8
+extern void* str_wonder_room_on_ref;
9
+
10
+u8 set_or_delete_rooms() {
11
+    struct field_affecting* field = &custom_battle_elements.ptr->field_affecting;
12
+    switch (battle_executed_move) {
13
+        case MOVE_TRICK_ROOM:
14
+            if (field->trick_room) {
15
+                field->trick_room = 0;
16
+                battle_string_chooser = str_trick_room_off_ref;
17
+            } else {
18
+                field->trick_room = 5;
19
+                battle_string_chooser = str_trick_room_on_ref;
20
+            }
21
+            break;
22
+        case MOVE_MAGIC_ROOM:
23
+            if (field->magic_room) {
24
+                field->magic_room = 0;
25
+                battle_string_chooser = str_magic_room_off_ref;
26
+            } else {
27
+                field->magic_room = 5;
28
+                battle_string_chooser = str_magic_room_on_ref;
29
+            }
30
+            break;
31
+        case MOVE_WONDER_ROOM:
32
+            if (field->wonder_room) {
33
+                field->wonder_room = 0;
34
+                battle_string_chooser = str_wonder_room_off_ref;
35
+            } else {
36
+                field->wonder_room = 5;
37
+                battle_string_chooser = str_wonder_room_on_ref;
38
+            }
39
+            break;
40
+    }
41
+    return false;
42
+}

+ 20
- 0
src/moves/rooms/rooms_script.S View File

@@ -0,0 +1,20 @@
1
+#include <battle_script.h>
2
+
3
+.align 2
4
+.thumb
5
+.text
6
+
7
+.global bs_rooms
8
+bs_rooms:
9
+    attackcanceler
10
+    attackstring
11
+    ppreduce
12
+    attackanimation
13
+    waitanimation
14
+    callasm set_or_delete_rooms+1
15
+    printstring 0x184
16
+    waitmessage 0x40
17
+    goto 0x081D694E
18
+
19
+
20
+

+ 4
- 0
src/moves/swap_moves/swap_moves.c View File

@@ -56,6 +56,10 @@ u8 set_swap_moves() {
56 56
             attacker->sp_atk_buff = defender->sp_atk_buff;
57 57
             defender->sp_atk_buff = swap;
58 58
             battle_string_chooser = str_heart_swap_ref;
59
+            
60
+            swap = attacker->acc_buff;
61
+            attacker->acc_buff = defender->acc_buff;
62
+            defender->acc_buff = swap;
59 63
             break;
60 64
     }
61 65
     return false;

+ 8
- 1
string/de/move_strings.txt View File

@@ -8,4 +8,11 @@ str_power_swap=\hFD\h0F tauscht seinen Angriff\nund Spezialangriff mit dem Ziel!
8 8
 str_guard_swap=\hFD\h0F tauscht seine Verteidigung\nund Spezialverteidigung mit dem Ziel!
9 9
 str_heart_swap=\hFD\h0F tauscht seine Statusveränderungen\nmit den Ziel!
10 10
 str_worry_seed=\hFD\h10 nimmt die Fähigkeit\nInsomnia an!
11
-str_magnet_rise=\hFD\h0F schwebt aufgrund von\nElektromagnetismus!
11
+str_magnet_rise=\hFD\h0F schwebt aufgrund von\nElektromagnetismus!
12
+str_trick_room_on=\hFD\h0F hat die Dimensionen\nverdreht!
13
+str_trick_room_off=Die Dimensionen sind wieder\nnormal!
14
+str_magic_room_on=Es entsteht ein Raum in dem\ngetragene Items ihre Wirkung verlieren!
15
+str_magic_room_off=Der Magieraum verschwindet!
16
+str_wonder_room_on=Es entsteht ein Raum in dem Verteidigung\nund Spezialverteidigung getauscht sind.
17
+str_wonder_room_off=Der Wunderraum verschwindet!
18
+str_lunardance_executed=Das Opfer erreicht \hFD\h13!