* The player moves through the air for a few squares as a result of * throwing or kicking something. * * dx and dy should be the direction of the hurtle, not of the original * kick or throw. */
| 1075 | * kick or throw. |
| 1076 | */ |
| 1077 | void |
| 1078 | hurtle(int dx, int dy, int range, boolean verbose) |
| 1079 | { |
| 1080 | coord uc, cc; |
| 1081 | |
| 1082 | /* The chain is stretched vertically, so you shouldn't be able to move |
| 1083 | * very far diagonally. The premise that you should be able to move one |
| 1084 | * spot leads to calculations that allow you to only move one spot away |
| 1085 | * from the ball, if you are levitating over the ball, or one spot |
| 1086 | * towards the ball, if you are at the end of the chain. Rather than |
| 1087 | * bother with all of that, assume that there is no slack in the chain |
| 1088 | * for diagonal movement, give the player a message and return. |
| 1089 | */ |
| 1090 | if (Punished && !carried(uball)) { |
| 1091 | You_feel("a tug from the iron ball."); |
| 1092 | nomul(0); |
| 1093 | return; |
| 1094 | } else if (u.utrap) { |
| 1095 | You("are anchored by the %s.", |
| 1096 | (u.utraptype == TT_WEB) ? "web" |
| 1097 | : (u.utraptype == TT_LAVA) ? hliquid("lava") |
| 1098 | : (u.utraptype == TT_INFLOOR) ? surface(u.ux, u.uy) |
| 1099 | : (u.utraptype == TT_BURIEDBALL) ? "buried ball" |
| 1100 | : "trap"); |
| 1101 | nomul(0); |
| 1102 | return; |
| 1103 | } |
| 1104 | |
| 1105 | /* make sure dx and dy are [-1,0,1] */ |
| 1106 | dx = sgn(dx); |
| 1107 | dy = sgn(dy); |
| 1108 | |
| 1109 | if (!range || (!dx && !dy) || u.ustuck) |
| 1110 | return; /* paranoia */ |
| 1111 | |
| 1112 | nomul(-range); |
| 1113 | gm.multi_reason = "moving through the air"; |
| 1114 | gn.nomovemsg = ""; /* it just happens */ |
| 1115 | if (verbose) |
| 1116 | You("%s in the opposite direction.", |
| 1117 | (range > 1) ? "hurtle" : "float"); |
| 1118 | /* if we're in the midst of shooting multiple projectiles, stop */ |
| 1119 | endmultishot(TRUE); |
| 1120 | uc.x = u.ux; |
| 1121 | uc.y = u.uy; |
| 1122 | /* this setting of cc is only correct if dx and dy are [-1,0,1] only */ |
| 1123 | cc.x = u.ux + (dx * range); |
| 1124 | cc.y = u.uy + (dy * range); |
| 1125 | (void) walk_path(&uc, &cc, hurtle_step, (genericptr_t) &range); |
| 1126 | } |
| 1127 | |
| 1128 | /* Move a monster through the air for a few squares. */ |
| 1129 | void |
no test coverage detected