dual-wield-patch.txt
patches · 8.8 KB · 2010-03-30
Download « Back to the patches list
diff -ur ../rom2.4/src/act_info.c src/act_info.c
--- ../rom2.4/src/act_info.c Mon Oct 23 18:47:54 1995
+++ src/act_info.c Sun Feb 4 00:13:18 1996
@@ -72,6 +72,7 @@
"<wielded> ",
"<held> ",
"<floating nearby> ",
+ "<secondary weapon> " /* ADD THIS */
};
diff -ur ../rom2.4/src/act_obj.c src/act_obj.c
--- ../rom2.4/src/act_obj.c Mon Oct 23 18:48:34 1995
+++ src/act_obj.c Sun Feb 4 00:01:23 1996
@@ -1587,6 +1587,11 @@
send_to_char("Your hands are tied up with your weapon!\n\r",ch);
return;
}
+ if (get_eq_char (ch, WEAR_SECONDARY) != NULL)
+ {
+ send_to_char ("You cannot use a shield while using 2 weapons.\n\r"
,ch);
+ return;
+ }
act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM );
act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR );
@@ -1651,6 +1656,13 @@
{
if ( !remove_obj( ch, WEAR_HOLD, fReplace ) )
return;
+
+ if (get_eq_char (ch, WEAR_SECONDARY) != NULL)
+ {
+ send_to_char ("You cannot hold an item while using 2 weapons.\n\r"
,ch);
+ return;
+ }
+
act( "$n holds $p in $s hand.", ch, obj, NULL, TO_ROOM );
act( "You hold $p in your hand.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_HOLD );
@@ -2957,5 +2969,81 @@
act( buf, keeper, obj, ch, TO_VICT );
ch->reply = keeper;
+ return;
+}
+
+void do_second (CHAR_DATA *ch, char *argument)
+/* wear object as a secondary weapon */
+{
+ OBJ_DATA *obj;
+ char buf[MAX_STRING_LENGTH]; /* overkill, but what the heck */
+
+ if (argument[0] == '\0') /* empty */
+ {
+ send_to_char ("Wear which weapon in your off-hand?\n\r",ch);
+ return;
+ }
+
+ obj = get_obj_carry (ch, argument); /* find the obj withing ch's inventory
*/
+
+ if (obj == NULL)
+ {
+ send_to_char ("You have no such thing in your backpack.\n\r",ch);
+ return;
+ }
+
+
+ /* check if the char is using a shield or a held weapon */
+
+ if ( (get_eq_char (ch,WEAR_SHIELD) != NULL) ||
+ (get_eq_char (ch,WEAR_HOLD) != NULL) )
+ {
+ send_to_char ("You cannot use a secondary weapon while using a shield
or holding an item\n\r",ch);
+ return;
+ }
+
+
+ if ( ch->level < obj->level )
+ {
+ sprintf( buf, "You must be level %d to use this object.\n\r",
+ obj->level );
+ send_to_char( buf, ch );
+ act( "$n tries to use $p, but is too inexperienced.",
+ ch, obj, NULL, TO_ROOM );
+ return;
+ }
+
+/* check that the character is using a first weapon at all */
+ if (get_eq_char (ch, WEAR_WIELD) == NULL) /* oops - != here was a bit wron
g :) */
+ {
+ send_to_char ("You need to wield a primary weapon, before using a seco
ndary one!\n\r",ch);
+ return;
+ }
+
+
+/* check for str - secondary weapons have to be lighter */
+ if ( get_obj_weight( obj ) > ( str_app[get_curr_stat(ch,STAT_STR)].wield /
2) )
+ {
+ send_to_char( "This weapon is too heavy to be used as a secondary weap
on by you.\n\r", ch );
+ return;
+ }
+
+/* check if the secondary weapon is at least half as light as the primary weap
on */
+ if ( (get_obj_weight (obj)*2) > get_obj_weight(get_eq_char(ch,WEAR_WIELD))
)
+ {
+ send_to_char ("Your secondary weapon has to be considerably lighter th
an the primary one.\n\r",ch);
+ return;
+ }
+
+/* at last - the char uses the weapon */
+
+ if (!remove_obj(ch, WEAR_SECONDARY, TRUE)) /* remove the current weapon if
any */
+ return; /* remove obj tells about any n
o_remove */
+
+/* char CAN use the item! that didn't take long at aaall */
+
+ act ("$n wields $p in $s off-hand.",ch,obj,NULL,TO_ROOM);
+ act ("You wield $p in your off-hand.",ch,obj,NULL,TO_CHAR);
+ equip_char ( ch, obj, WEAR_SECONDARY);
return;
}
diff -ur ../rom2.4/src/fight.c src/fight.c
--- ../rom2.4/src/fight.c Mon Oct 23 19:41:59 1995
+++ src/fight.c Sat Feb 3 23:34:15 1996
@@ -69,7 +69,7 @@
int total_levels ) );
bool is_safe args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void make_corpse args( ( CHAR_DATA *ch ) );
-void one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
+void one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, bool secondar
y ) );
void mob_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int d
t ) );
void raw_kill args( ( CHAR_DATA *victim ) );
void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
@@ -223,13 +223,20 @@
return;
}
- one_hit( ch, victim, dt );
+ one_hit( ch, victim, dt, FALSE );
+
+ if (get_eq_char (ch, WEAR_SECONDARY))
+ {
+ one_hit( ch, victim, dt, TRUE );
+ if ( ch->fighting != victim )
+ return;
+ }
if (ch->fighting != victim)
return;
if (IS_AFFECTED(ch,AFF_HASTE))
- one_hit(ch,victim,dt);
+ one_hit(ch,victim,dt, FALSE);
if ( ch->fighting != victim || dt == gsn_backstab )
return;
@@ -241,7 +248,7 @@
if ( number_percent( ) < chance )
{
- one_hit( ch, victim, dt );
+ one_hit( ch, victim, dt, FALSE );
check_improve(ch,gsn_second_attack,TRUE,5);
if ( ch->fighting != victim )
return;
@@ -254,7 +261,7 @@
if ( number_percent( ) < chance )
{
- one_hit( ch, victim, dt );
+ one_hit( ch, victim, dt, FALSE );
check_improve(ch,gsn_third_attack,TRUE,6);
if ( ch->fighting != victim )
return;
@@ -269,7 +276,7 @@
int chance,number;
CHAR_DATA *vch, *vch_next;
- one_hit(ch,victim,dt);
+ one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
@@ -282,13 +289,13 @@
{
vch_next = vch->next;
if ((vch != victim && vch->fighting == ch))
- one_hit(ch,vch,dt);
+ one_hit(ch,vch,dt, FALSE);
}
}
if (IS_AFFECTED(ch,AFF_HASTE)
|| (IS_SET(ch->off_flags,OFF_FAST) && !IS_AFFECTED(ch,AFF_SLOW)))
- one_hit(ch,victim,dt);
+ one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim || dt == gsn_backstab)
return;
@@ -300,7 +307,7 @@
if (number_percent() < chance)
{
- one_hit(ch,victim,dt);
+ one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
}
@@ -312,7 +319,7 @@
if (number_percent() < chance)
{
- one_hit(ch,victim,dt);
+ one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
}
@@ -399,7 +406,7 @@
/*
* Hit one guy once.
*/
-void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
+void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, bool secondary )
{
OBJ_DATA *wield;
int victim_ac;
@@ -428,8 +435,12 @@
/*
* Figure out the type of damage message.
+ * if secondary == true, use the second weapon.
*/
- wield = get_eq_char( ch, WEAR_WIELD );
+ if (!secondary)
+ wield = get_eq_char( ch, WEAR_WIELD );
+ else
+ wield = get_eq_char( ch, WEAR_SECONDARY );
if ( dt == TYPE_UNDEFINED )
{
diff -ur ../rom2.4/src/interp.c src/interp.c
--- ../rom2.4/src/interp.c Mon Oct 23 18:51:46 1995
+++ src/interp.c Sat Feb 3 23:44:51 1996
@@ -225,6 +225,7 @@
{ "recite", do_recite, POS_RESTING, 0, LOG_NORMAL
, 1 },
{ "remove", do_remove, POS_RESTING, 0, LOG_NORMAL
, 1 },
{ "sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1 },
+ { "second", do_second, POS_RESTING, 0, LOG_NORMAL
, 1 },
{ "take", do_get, POS_RESTING, 0, LOG_NORMAL, 1 },
{ "sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1 },
{ "junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 },
diff -ur ../rom2.4/src/interp.h src/interp.h
--- ../rom2.4/src/interp.h Mon Oct 23 18:54:55 1995
+++ src/interp.h Sat Feb 3 23:45:12 1996
@@ -234,6 +234,7 @@
DECLARE_DO_FUN( do_say );
DECLARE_DO_FUN( do_score );
DECLARE_DO_FUN( do_scroll );
+DECLARE_DO_FUN( do_second );
DECLARE_DO_FUN( do_sell );
DECLARE_DO_FUN( do_set );
DECLARE_DO_FUN( do_shout );
diff -ur ../rom2.4/src/merc.h src/merc.h
--- ../rom2.4/src/merc.h Mon Oct 23 18:56:23 1995
+++ src/merc.h Sat Feb 3 23:27:49 1996
@@ -1174,7 +1174,8 @@
#define WEAR_WIELD 16
#define WEAR_HOLD 17
#define WEAR_FLOAT 18
-#define MAX_WEAR 19
+#define WEAR_SECONDARY 19
+#define MAX_WEAR 20