diff --git a/src/protocol.h b/src/protocol.h index 84b31c7..485b337 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -27,7 +27,7 @@ #include #include -constexpr int PROTOCOL_VERSION = 8; +constexpr int PROTOCOL_VERSION = 9; constexpr int LOBBY_MEMBERS_MAX = 16; constexpr int LOBBY_CODE_LENGTH = 4; // Letters only, without I and O, so codes are easy to read out and type. diff --git a/src/weapon.cpp b/src/weapon.cpp index 3637a7f..0134e3f 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -46,6 +46,9 @@ constexpr float SLAM_RATIO = 1.05f; constexpr float SPEED_DAMAGE = 0.05f; // A normal attack let go partway through a charge hits harder, up to this much more just short of full. constexpr float PARTIAL_CHARGE_BONUS = 0.5f; +// How many times as hard a shot hits once an airblast sends it back, anyone's, stacking with each one: twice what a +// Ricochet bounce adds, as it takes aim and timing. +constexpr float REFLECT_BONUS = 1.5f; constexpr float SPEED_UNIT = 100; constexpr float CONTACT_INTERVAL = 0.4f; constexpr float WISP_GLIDE = 14; @@ -2224,11 +2227,12 @@ static void shot_restore(Attack& shot, float share) // Moves every shot in an attack's cone (from its position along its aim, out to its range), anyone's: a blow turns each // to fly straight out of the cone from its point (along the aim, give or take where in the cone it is), at its own -// speed plus the blow's, and pull speeds each toward the point. A shot stuck to a surface comes loose first (a -// grapple's hook too), popping out toward the point at the cone's own speed when pulled, and glancing off the surface -// if it would head straight back in. A claiming attack makes other fighters' shots its owner's, burst into its color -// (all but those tied to their fighter's weapon: on a rope or chain, waiting to be set off, or the weapon itself). The -// owner's own shots then get back restore's share of what they set off with (see shot_restore). +// speed plus the blow's, hitting harder for it (REFLECT_BONUS), and pull speeds each toward the point. A shot stuck to +// a surface comes loose first (a grapple's hook too), popping out toward the point at the cone's own speed when pulled, +// and glancing off the surface if it would head straight back in. A claiming attack makes other fighters' shots its +// owner's, burst into its color (all but those tied to their fighter's weapon: on a rope or chain, waiting to be set +// off, or the weapon itself). The owner's own shots then get back restore's share of what they set off with (see +// shot_restore). void Weapons::shots_drift(Sim& sim, Attack& source, float blow, float pull, float restore) { for (Attack& shot : attacks) @@ -2262,7 +2266,11 @@ void Weapons::shots_drift(Sim& sim, Attack& source, float blow, float pull, floa shot.isHeld |= pull > 0; shot.velocity = shot.velocity + toward * pull * boxing; if (blow > 0) + { shot.velocity = toward * -(vec2_length(shot.velocity) + blow * boxing); + shot.bonus *= shot.blowTime == shot.time ? 1 : REFLECT_BONUS; + shot.blowTime = shot.time; + } Vec2 next = shot.position + shot.velocity * TICK; if (isLoosened && sim.world.is_blocking_at(next)) shot.velocity = reflect_get(sim, shot.position, next, shot.velocity); diff --git a/src/weapon.h b/src/weapon.h index f1cbacb..df8f394 100644 --- a/src/weapon.h +++ b/src/weapon.h @@ -1367,6 +1367,8 @@ struct Attack float length = 0; // When it was claimed from another fighter, whose color it turns from (see Weapons::shots_drift). float claimTime = 0; + // When it was last blown back (its own time), so overlapping blows (Splitter copies) add REFLECT_BONUS once. + float blowTime = -1; float lifeStart = 0; float lifetime = 0; float orbitAngle = 0;