@@ -27,43 +27,71 @@ pub unsafe extern "C" fn material_table_hook(fighter: &mut Fighter, arg2: u64, a
27
27
] ;
28
28
29
29
let pickel = & mut ( * fighter) . battle_object ;
30
- let index = VarModule :: get_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX ) as i32 ;
31
- let material = material_table[ index as usize ] as u32 ; // stores current table index to return
32
- if VarModule :: is_flag ( pickel, vars:: pickel:: instance:: SHOULD_CYCLE_MATERIAL ) {
33
- if material == ( gold as u32 ) { // add redstone to gold entries
34
- let pickel_boma = pickel. module_accessor ;
35
- let current_redstone = WorkModule :: get_int ( pickel_boma, * FIGHTER_PICKEL_INSTANCE_WORK_ID_INT_MATERIAL_NUM_RED_STONE ) ;
36
- let max_redstone = WorkModule :: get_param_int ( pickel_boma, hash40 ( "param_private" ) , hash40 ( "material_red_stone_max" ) ) ;
37
- let mut gain_amount = 6 ; // number of redstone steve should receive when mining gold
38
- if ( current_redstone + gain_amount) <= max_redstone {
39
- FighterSpecializer_Pickel :: add_material_num ( pickel_boma, * FIGHTER_PICKEL_MATERIAL_KIND_RED_STONE , gain_amount) ;
40
- } else if current_redstone != max_redstone {
41
- gain_amount = max_redstone - current_redstone;
42
- FighterSpecializer_Pickel :: add_material_num ( pickel_boma, * FIGHTER_PICKEL_MATERIAL_KIND_RED_STONE , gain_amount) ;
30
+ let kind = pickel. kind as i32 ;
31
+ if kind != * FIGHTER_KIND_KIRBY {
32
+ let index = VarModule :: get_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX ) as i32 ;
33
+ let material = material_table[ index as usize ] as u32 ; // stores current table index to return
34
+ if VarModule :: is_flag ( pickel, vars:: pickel:: instance:: SHOULD_CYCLE_MATERIAL ) {
35
+ if material == ( gold as u32 ) { // add redstone to gold entries
36
+ let pickel_boma = pickel. module_accessor ;
37
+ let current_redstone = WorkModule :: get_int ( pickel_boma, * FIGHTER_PICKEL_INSTANCE_WORK_ID_INT_MATERIAL_NUM_RED_STONE ) ;
38
+ let max_redstone = WorkModule :: get_param_int ( pickel_boma, hash40 ( "param_private" ) , hash40 ( "material_red_stone_max" ) ) ;
39
+ let mut gain_amount = 6 ; // number of redstone steve should receive when mining gold
40
+ if ( current_redstone + gain_amount) <= max_redstone {
41
+ FighterSpecializer_Pickel :: add_material_num ( pickel_boma, * FIGHTER_PICKEL_MATERIAL_KIND_RED_STONE , gain_amount) ;
42
+ } else if current_redstone != max_redstone {
43
+ gain_amount = max_redstone - current_redstone;
44
+ FighterSpecializer_Pickel :: add_material_num ( pickel_boma, * FIGHTER_PICKEL_MATERIAL_KIND_RED_STONE , gain_amount) ;
45
+ }
43
46
}
47
+ if ( 0 ..99 ) . contains ( & index) { // continue the cycle
48
+ VarModule :: inc_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX ) ;
49
+ } else { // reset the cycle
50
+ VarModule :: set_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX , 0 ) ;
51
+ }
52
+ VarModule :: off_flag ( pickel, vars:: pickel:: instance:: SHOULD_CYCLE_MATERIAL ) ;
53
+ VarModule :: set_int ( pickel, vars:: pickel:: status:: MINING_TIMER , 2 ) ;
54
+ // logging for debug purposes
55
+ // let mut mat_name = "nothing lol";
56
+ // if material == 0 { mat_name = "dirt"; }
57
+ // else if material == 1 { mat_name = "wood"; }
58
+ // else if material == 2 { mat_name = "stone"; }
59
+ // else if material == 3 { mat_name = "iron"; }
60
+ // else if material == 4 { mat_name = "gold"; }
61
+ // else if material == 5 { mat_name = "redstone"; }
62
+ // else if material == 6 { mat_name = "diamond"; }
63
+ // else { mat_name = "...what?"; }
64
+ // println!("Steve mines entry {}/100, which is {}.", (index +1), mat_name);
65
+ }
66
+
67
+ return material;
68
+ } else { // alternative logic for kirby
69
+ let index = VarModule :: get_int ( pickel, vars:: kirby:: instance:: MATERIAL_INDEX ) as i32 ;
70
+ let material = material_table[ index as usize ] as u32 ; // stores current table index to return
71
+ if VarModule :: is_flag ( pickel, vars:: kirby:: instance:: SHOULD_CYCLE_MATERIAL ) {
72
+ if ( 0 ..99 ) . contains ( & index) { // continue the cycle
73
+ VarModule :: inc_int ( pickel, vars:: kirby:: instance:: MATERIAL_INDEX ) ;
74
+ } else { // reset the cycle
75
+ VarModule :: set_int ( pickel, vars:: kirby:: instance:: MATERIAL_INDEX , 0 ) ;
76
+ }
77
+ VarModule :: off_flag ( pickel, vars:: kirby:: instance:: SHOULD_CYCLE_MATERIAL ) ;
78
+ VarModule :: set_int ( pickel, vars:: kirby:: status:: MINING_TIMER , 2 ) ;
79
+ // logging for debug purposes
80
+ // let mut mat_name = "nothing lol";
81
+ // if material == 0 { mat_name = "dirt"; }
82
+ // else if material == 1 { mat_name = "wood"; }
83
+ // else if material == 2 { mat_name = "stone"; }
84
+ // else if material == 3 { mat_name = "iron"; }
85
+ // else if material == 4 { mat_name = "gold. He gets iron instead"; }
86
+ // else if material == 6 { mat_name = "diamond. He gets iron instead"; }
87
+ // else { mat_name = "...what?"; }
88
+ // println!("Kirby mines entry {}/100, which is {}.", (index +1), mat_name);
44
89
}
45
- if ( 0 ..99 ) . contains ( & index) { // continue the cycle
46
- VarModule :: inc_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX ) ;
47
- } else { // reset the cycle
48
- VarModule :: set_int ( pickel, vars:: pickel:: instance:: MATERIAL_INDEX , 0 ) ;
90
+ if material == ( 4 | 6 ) {
91
+ return 3 ; // give kirby iron instead of gold/diamond
49
92
}
50
- VarModule :: off_flag ( pickel, vars:: pickel:: instance:: SHOULD_CYCLE_MATERIAL ) ;
51
- VarModule :: set_int ( pickel, vars:: pickel:: status:: MINING_TIMER , 2 ) ;
52
- // logging for debug purposes
53
- // let mut mat_name = "nothing lol";
54
- // if material == 0 { mat_name = "dirt"; }
55
- // else if material == 1 { mat_name = "wood"; }
56
- // else if material == 2 { mat_name = "stone"; }
57
- // else if material == 3 { mat_name = "iron"; }
58
- // else if material == 4 { mat_name = "gold"; }
59
- // else if material == 5 { mat_name = "redstone"; }
60
- // else if material == 6 { mat_name = "diamond"; }
61
- // else { mat_name = "...what?"; }
62
- // println!("Steve mines entry {}/100, which is {}.", (index +1), mat_name);
93
+ return material;
63
94
}
64
-
65
-
66
- return material;
67
95
}
68
96
69
97
// overrides stage id check for things such as mining speed
0 commit comments