Advertisement
Dancer_A

Spindash (untested)

Apr 21st, 2024 (edited)
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.63 KB | None | 0 0
  1. // Spindash
  2.  
  3. // CombatConfig.cs
  4.     public class Combat
  5.     {
  6.     .
  7.     .
  8.     .
  9.         public const int SPINDASH_ATK_SPD = 6; // change here if it needs to be edited
  10.     .
  11.     .
  12.     .
  13.     }
  14.  
  15. // Game_Unit_Skill.cs
  16.         internal void dmg_skill(
  17.             ref int skill_dmg, ref int weapon_dmg, ref int actor_dmg, ref int support_dmg,
  18.             ref int target_def, Data_Weapon weapon,
  19.             Game_Unit target, Data_Weapon target_weapon, WeaponTriangle tri, bool magic,
  20.             int? distance, float effectiveness = 1)
  21.         {
  22.         .
  23.         .
  24.         .
  25.             // Skill: Spindash
  26.             if (target != null)
  27.                 if (actor.has_skill("SPINDASH") && Temp_Moved >= 1 && Global.game_state.team_turn == team)
  28.                     skill_dmg += Temp_Moved;
  29.         }
  30.  
  31. // New function
  32. // placed under is_brave_blocked()
  33.         public bool is_brave(Game_Unit target)
  34.         {
  35.             bool bravery = false;
  36.             // Skills: Spindash
  37.             if (target != null)
  38.             {
  39.                 int speedmult = actor.atk_spd(distance) - target.atk_spd(distance);
  40.                 if ((actor.has_skill("SPINDASH") && speedmult >= Constants.Combat.SPINDASH_ATK_SPD && Global.game_state.team_turn == team)
  41.                     bravery = true;
  42.             }
  43.             return bravery;
  44.         }
  45.  
  46. // Multiplier_Img.cs
  47.         public int get_multi(Game_Unit unit, Combat_Map_Object target, TactileLibrary.Data_Weapon weapon, int distance)
  48.         {
  49.             int multi = 0;
  50.             if (!target.is_unit())
  51.                 return 0;
  52.             if ((weapon.Brave() || unit.is_brave(target as Game_Unit)) && !unit.is_brave_blocked()) // <-- the new line
  53.                 multi += 4;
  54.             if (unit.can_double_attack(target, distance))
  55.                 multi += 2;
  56.             return multi / 2;
  57.         }    
  58.                    
  59. // Combat_Data.cs
  60.         private void add_attacks(
  61.             Game_Unit battler_1, Combat_Map_Object battler_2,
  62.             int i, Data_Weapon weapon)
  63.         {
  64. #if DEBUG
  65.             System.Diagnostics.Debug.Assert(i == 1 || i == 2);
  66. #endif
  67.             Game_Unit attacker = i == 2 ? battler_2 as Game_Unit : battler_1;
  68.             Combat_Map_Object target = i == 2 ? battler_1 : battler_2;
  69.  
  70.             int num_hits = 1;
  71.             if (!attacker.is_brave_blocked())
  72.             {
  73.                 // If only single hits against terrain
  74.                 if (!(target != null && !target.is_unit() &&
  75.                         Constants.Combat.BRAVE_BLOCKED_AGAINST_DESTROYABLE))
  76.                     num_hits = weapon.HitsPerAttack;
  77.                 if (num_hits == 1)
  78.                     if (attacker.is_brave(target as Game_Unit)) // <-- new line
  79.                         num_hits = 2;
  80.             }
  81.             for (int j = 0; j < num_hits; j++)
  82.                 add_attacks(battler_1, battler_2, i);
  83.         }
  84.  
  85. // Game_Unit.cs
  86.         private int attacks_per_round(int spd, Combat_Map_Object target, int distance)
  87.         {
  88.             if (target.is_unit() && !is_double_disabled())
  89.                 if (!stop_follow_up_modifiers(target as Game_Unit) && !(target as Game_Unit).stop_follow_up_modifiers(this))
  90.                 {
  91.                     int target_spd = (target as Game_Unit).atk_spd(distance);
  92.                     // If Spin Dash active, drop attacks per round to 1, make exception for brave weapons? idk
  93.                     if (this.is_brave(target as Game_Unit))
  94.                         return 1;
  95.                     // If enough faster than the opponent, attack twice
  96.                     if (spd - Constants.Combat.DBL_ATK_SPD >= target_spd)
  97.                         return 2;
  98.                 }
  99.             return 1;
  100.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement