-
Notifications
You must be signed in to change notification settings - Fork 2
/
effects.c
963 lines (825 loc) · 31.5 KB
/
effects.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
/***********************************************************************
* *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans-Henrik Stæfeldt, Tom Madsen and Katja Nyboe *
* *
* Merc Diku Mud improvements copyright (C) 1992, 1993 by *
* Michael Chastain, Michael Quan, and Mitchell Tse *
* *
* ROM 2.4 is copyright 1993-1998 Russ Taylor *
* Russ Taylor (rtaylor@hypercube.org) *
* Gabrielle Taylor (gtaylor@hypercube.org) *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
* *
***********************************************************************
* *
* KILLER MUD is copyright 1999-2011 Killer MUD Staff (alphabetical) *
* *
* Andrzejczak Dominik (kainti@go2.pl ) [Kainti ] *
* Jaron Krzysztof (chris.jaron@gmail.com ) [Razor ] *
* Pietrzak Marcin (marcin@iworks.pl ) [Gurthg ] *
* Sawicki Tomasz (furgas@killer-mud.net ) [Furgas ] *
* Trebicki Marek (maro@killer.radom.net ) [Maro ] *
* Zdziech Tomasz (t.zdziech@elka.pw.edu.pl ) [Agron ] *
* *
***********************************************************************
*
* $Id: effects.c 110 2013-07-18 08:34:31Z gurthg $
* $HeadURL: svn+ssh://svn@killer.mud.pl/killer/branches/current/src/effects.c $
*
*/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "recycle.h"
#include "tables.h"
#include "progs.h"
#define DAMAGE_MULTIPLIER 33
/* funckja testujaca zniszczenie obiektu od roznego rodzaju ataku
* zwraca true jesli obiekt zniszczy sie, else false
*/
bool check_item_resist( OBJ_DATA *obj, int type, int dam )
{
int resist;
switch ( type )
{
case RESIST_FIRE: resist = material_table[ obj->material ].fire_res;break;
case RESIST_ACID: resist = material_table[ obj->material ].acid_res;break;
case RESIST_ELECTRICITY: resist = material_table[ obj->material ].shock_res;break;
case RESIST_COLD: resist = material_table[ obj->material ].cold_res;break;
default: resist = material_table[ obj->material ].other_res;break;
}
if ( IS_OBJ_STAT( obj, ITEM_UNDESTRUCTABLE ) )
return FALSE;
if ( type == RESIST_SOUND && material_table[ obj->material ].flag != MAT_EASYBREAK )
return FALSE;
if ( type == RESIST_FIRE && IS_OBJ_STAT( obj, ITEM_BURN_PROOF ))
return FALSE;
if ( type == RESIST_FIRE && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_FLAMING || IS_SET( obj->value[ 4 ], WEAPON_FLAMING_BURST ))))
return FALSE;
if ( type == RESIST_ACID && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_TOXIC || IS_SET( obj->value[ 4 ], WEAPON_TOXIC_BURST ))))
return FALSE;
if ( type == RESIST_ELECTRICITY && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_SHOCKING || IS_SET( obj->value[ 4 ], WEAPON_SHOCKING_BURST ))))
return FALSE;
if ( type == RESIST_COLD && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_FROST || IS_SET( obj->value[ 4 ], WEAPON_FROST_BURST ))))
return FALSE;
if ( type == RESIST_SOUND && obj->item_type == ITEM_WEAPON && ( IS_SET( obj->value[ 4 ], WEAPON_RESONANT || IS_SET( obj->value[ 4 ], WEAPON_SONIC_BURST ))))
return FALSE;
if ( IS_OBJ_STAT( obj, ITEM_BLESS ) )
resist = URANGE( 0, resist + 15, 100 );
if ( IS_OBJ_STAT( obj, ITEM_MAGIC ) )
resist = URANGE( 0, resist + 35, 100 );
if ( ( obj->item_type == ITEM_DRINK_CON ||
obj->item_type == ITEM_POTION ) &&
type == RESIST_COLD )
resist = URANGE( 0, resist + 20, 100 );
// resist = 20; Brohacz: zmiana na += i URANGE;
if ( ( obj->item_type == ITEM_WAND ||
obj->item_type == ITEM_STAFF ) &&
type == RESIST_ELECTRICITY )
resist = URANGE( 0, resist + 20, 100 );
// resist = 20; Brohacz: zmiana na += i URANGE;
/* Tener: zmieniam odporno¶æ tego typu przedmiotów z 20 na 80 procent. Powód? S± magiczne!
* Rellik: papier magiczny pali siê tak samo dobrze jak zwyk³y... ;) */
//2008-11-20, Brohacz: to zalezy, czy ksiazka ma flage magic. Przywracam resist 20, nie ulatwiajmy zdobywania ksiag w pojedynke, a przeciez o to tu chodzi.
if ( ( obj->item_type == ITEM_SPELLBOOK ||
obj->item_type == ITEM_SCROLL ) &&
type == RESIST_FIRE )
resist = URANGE( 0, resist + 20, 100 );
// resist = 20; Brohacz: zmiana na += i URANGE;
dam = DAMAGE_MULTIPLIER * dam / 100;
dam = ( 100 - resist ) * dam / 100;
dam = URANGE( 0, dam, 100 );
obj->condition -= dam;
if ( obj->condition < 0 )
return TRUE;
return FALSE;
}
/* kwasowy efekt */
void acid_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_ROOM )
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
continue;
acid_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_CHAR ) /* do the effect on a victim */
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
if ( !victim->in_room )
return ;
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
/* brak sprawdzania czy zszedl */
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
acid_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_OBJ ) /* toast an object */
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
OBJ_DATA *t_obj, *n_obj;
char *msg;
/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
if ( !check_item_resist( obj, RESIST_ACID, dam ) )
return ;
if( obj->liczba_mnoga )
{
switch ( obj->item_type )
{
case ITEM_CONTAINER:
case ITEM_CORPSE_PC:
case ITEM_CORPSE_NPC:
msg = "$p sycz± i rozpuszczaj± siê.";
break;
case ITEM_ARMOR:
case ITEM_WEAPON:
msg = "$p skwiercz± i rozpadaj± siê.";
break;
case ITEM_CLOTHING:
msg = "$p czerniej± i krusz± siê.";
break;
case ITEM_STAFF:
case ITEM_WAND:
msg = "$p czerniej± i pêkaj±.";
break;
case ITEM_SCROLL:
msg = "$p rozpuszczaj± siê w k³ebach dymu.";
break;
default:
msg = "$p rozpuszczaj± siê w k³ebach dymu.";
break;
}
}
else
{
switch ( obj->item_type )
{
case ITEM_CONTAINER:
case ITEM_CORPSE_PC:
case ITEM_CORPSE_NPC:
msg = "$p syczy i rozpuszcza siê.";
break;
case ITEM_ARMOR:
case ITEM_WEAPON:
msg = "$p skwierczy i rozpada siê.";
break;
case ITEM_CLOTHING:
msg = "$p czernieje i kruszy siê.";
break;
case ITEM_STAFF:
case ITEM_WAND:
msg = "$p czernieje i pêka.";
break;
case ITEM_SCROLL:
msg = "$p rozpuszcza siê w k³ebach dymu.";
break;
default:
msg = "$p rozpuszcza siê w k³ebach dymu.";
break;
}
}
if ( obj->carried_by != NULL )
act( msg, obj->carried_by, obj, NULL, TO_ALL );
else if ( obj->in_room != NULL && obj->in_room->people != NULL )
act( msg, obj->in_room->people, obj, NULL, TO_ALL );
/* get rid of the object */
if ( obj->contains ) /* dump contents */
{
for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
{
n_obj = t_obj->next_content;
obj_from_obj( t_obj );
if ( obj->in_room != NULL )
obj_to_room( t_obj, obj->in_room );
else if ( obj->carried_by != NULL )
obj_to_room( t_obj, obj->carried_by->in_room );
else
{
/*artefact*/
if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( t_obj );
continue;
}
acid_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
}
}
/*artefact*/
if ( is_artefact( obj ) ) extract_artefact( obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( obj );
return ;
}
}
void cold_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_ROOM ) /* nail objects on the floor */
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
continue;
cold_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_CHAR ) /* whack a character */
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
if ( !victim->in_room )
return ;
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
/* let's toast some gear */
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
cold_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_OBJ ) /* toast an object */
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
OBJ_DATA *t_obj, *n_obj;
char *msg;
if( obj->liczba_mnoga )
msg = "$p zamarzaj± i rozpryskuj± siê na kawa³ki!";
else
msg = "$p zamarza i rozpryskuje siê na kawa³ki!";
/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
if ( !check_item_resist( obj, RESIST_COLD, dam ) )
return ;
if ( obj->carried_by != NULL )
act( msg, obj->carried_by, obj, NULL, TO_ALL );
else if ( obj->in_room != NULL && obj->in_room->people != NULL )
act( msg, obj->in_room->people, obj, NULL, TO_ALL );
/* get rid of the object */
if ( obj->contains ) /* dump contents */
{
for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
{
n_obj = t_obj->next_content;
obj_from_obj( t_obj );
if ( obj->in_room != NULL )
obj_to_room( t_obj, obj->in_room );
else if ( obj->carried_by != NULL )
obj_to_room( t_obj, obj->carried_by->in_room );
else
{
/*artefact*/
if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( t_obj );
continue;
}
cold_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
}
}
/*artefact*/
if ( is_artefact( obj ) ) extract_artefact( obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( obj );
return ;
}
}
void fire_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_ROOM ) /* nail objects on the floor */
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
continue;
fire_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_CHAR ) /* do the effect on a victim */
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
if ( !victim->in_room )
return ;
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
/* let's toast some gear! */
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
fire_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_OBJ ) /* toast an object */
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
OBJ_DATA *t_obj, *n_obj;
char *msg;
/* Tener: przeniesienie if'a w dobre miejsce [20080523] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
if ( !check_item_resist( obj, RESIST_FIRE, dam ) )
return ;
/*
Gurthg
2003-04-01
powi±zanie levelu z szans± na zniszczenie grata
*/
/*ale ten if przecie nie ma sensu - przepuszcza itemy o ujemnej kondycji - kainti 2006 07 10
if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return ;*/
if(obj->liczba_mnoga)
{
switch ( obj->item_type )
{
case ITEM_CONTAINER:
msg = "$p zapalaj± siê i p³on±!";
break;
case ITEM_POTION:
msg = "$p bulgocz± i eksploduj±!";
break;
case ITEM_SCROLL:
msg = "$p skwiercz± i spalaj± siê!";
break;
case ITEM_STAFF:
msg = "$p dymi± siê i czerniej±!";
break;
case ITEM_WAND:
msg = "$p iskrz± siê i top±!";
break;
case ITEM_FOOD:
msg = "$p czerniej± i krusz± sie!";
break;
case ITEM_PILL:
msg = "$p czerniej± i krusz± sie!";
break;
case ITEM_GEM:
msg = "$p rozgrzewaj± siê i eksploduj±!";
break;
default:
msg = "$p zapalaj± siê i p³on±!";
break;
}
}
else
{
switch ( obj->item_type )
{
case ITEM_CONTAINER:
msg = "$p zapala siê i p³onie!";
break;
case ITEM_POTION:
msg = "$p bulgocze i eksploduje!";
break;
case ITEM_SCROLL:
msg = "$p skwierczy i spala siê!";
break;
case ITEM_STAFF:
msg = "$p dymi siê i czernieje!";
break;
case ITEM_WAND:
msg = "$p iskrzy siê i topi!";
break;
case ITEM_FOOD:
msg = "$p czernieje i kruszy sie!";
break;
case ITEM_PILL:
msg = "$p czernieje i kruszy sie!";
break;
case ITEM_GEM:
msg = "$p rozgrzewa siê i eksploduje!";
break;
default:
msg = "$p zapala siê i p³onie!";
break;
}
}
if ( obj->carried_by != NULL )
act( msg, obj->carried_by, obj, NULL, TO_ALL );
else if ( obj->in_room != NULL && obj->in_room->people != NULL )
act( msg, obj->in_room->people, obj, NULL, TO_ALL );
if ( obj->contains )
{
/* dump the contents */
for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
{
n_obj = t_obj->next_content;
obj_from_obj( t_obj );
if ( obj->in_room != NULL )
obj_to_room( t_obj, obj->in_room );
else if ( obj->carried_by != NULL )
obj_to_room( t_obj, obj->carried_by->in_room );
else
{
/*artefact*/
if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( t_obj );
continue;
}
fire_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
}
}
/*artefact*/
if ( is_artefact( obj ) ) extract_artefact( obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( obj );
return ;
}
}
void poison_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_ROOM ) /* nail objects on the floor */
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
continue;
poison_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_CHAR ) /* do the effect on a victim */
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
if ( !victim->in_room )
return ;
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
/* chance of poisoning */
/* if (!saves_spell_new(victim, SAVE_DEATH, 0))
{
AFFECT_DATA af;
send_to_char("Czujesz jak trucizna rozprzestrzenia siê w twoich zylach.\n\r",victim);
act("$n wyglada bardzo niezdrowo.",victim,NULL,NULL,TO_ROOM);
af.where = TO_AFFECTS;
af.type = gsn_poison;
af.level = 4;
af.duration = dice(poison_table[4].duration[0],poison_table[4].duration[1]) + poison_table[4].duration[2];
af.rt_duration = 0;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = &AFF_POISON;
affect_join( victim, &af );
}*/
/* equipment */
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
poison_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_OBJ ) /* do some poisoning */
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
int chance;
if ( IS_OBJ_STAT( obj, ITEM_BLESS ))
return ;
/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
chance = level + dam / 7;
switch ( obj->item_type )
{
default:
return ;
case ITEM_FOOD:
break;
case ITEM_DRINK_CON:
if ( obj->value[ 0 ] == obj->value[ 1 ] )
return ;
break;
}
if ( number_percent() > chance )
return ;
obj->value[ 3 ] = 1;
return ;
}
}
void shock_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_ROOM )
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
continue;
shock_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
else if ( target == TARGET_CHAR )
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
if ( !victim->in_room )
return ;
/* jesli ma mozg znaczy siê mozna zszkokowac */
if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_BRAINS ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) &&
!is_undead( victim ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) )
{
int chance_of_knockout = 0;
if ( IS_SET( race_table[ GET_RACE( victim ) ].type, PERSON ) )
chance_of_knockout = 10 + dam/10 + level/10;
else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, ANIMAL ) )
chance_of_knockout = 5 + dam/11.5 + level/11.5;
else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, MONSTER ) )
chance_of_knockout = 3 + dam/13 + level/13;
if ( chance_of_knockout > 0 && number_percent() < chance_of_knockout && !IS_AFFECTED(victim,AFF_STABILITY) )
{
/* wait */
WAIT_STATE( victim, URANGE( 12, dam/3, 36 ) );
/* stoi badz walczy? no to hop na glebe */
if ( victim->position == POS_STANDING || victim->position == POS_FIGHTING )
{
if ( victim->sex == 0 )
{
send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomne na ziemie.\n\r", victim );
act( "$n osuwa siê polprzytomne na ziemie.", victim, NULL, NULL, TO_ROOM );
}
else if ( victim->sex == 1 )
{
send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomny na ziemie.\n\r", victim );
act( "$n osuwa siê polprzytomny na ziemie.", victim, NULL, NULL, TO_ROOM );
}
else
{
send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomna na ziemie.\n\r", victim );
act( "$n osuwa siê polprzytomna na ziemie.", victim, NULL, NULL, TO_ROOM );
}
victim->position = POS_SITTING;
}
/* lezy, siedzi, restuje, umiera etc? no to niech dalej umiera */
else
{
send_to_char( "Tracisz kontrolê nad swoim cia³em.\n\r", victim );
act( "Cia³o $z wyprê¿a siê i wiotczeje pod wp³ywem potê¿nego wy³adowania.", victim, NULL, NULL, TO_ROOM );
}
}
}
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
/* toast some gear */
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
shock_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
if ( target == TARGET_OBJ )
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
OBJ_DATA *t_obj, *n_obj;
char *msg;
/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
if ( obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF && obj->item_type != ITEM_JEWELRY )
return;
if ( !check_item_resist( obj, RESIST_ELECTRICITY, dam ) )
return ;
if(obj->liczba_mnoga)
{
switch ( obj->item_type )
{
default:
return ;
case ITEM_WAND:
case ITEM_STAFF:
msg = "$p rozb³yskuj± i po chwili eksploduj±!";
break;
case ITEM_JEWELRY:
msg = "$p stapiaj± siê w bezwarto¶ciow± bry³kê.";
}
}
else
{
switch ( obj->item_type )
{
default:
return ;
case ITEM_WAND:
case ITEM_STAFF:
msg = "$p rozb³yskuje i po chwili eksploduje!";
break;
case ITEM_JEWELRY:
msg = "$p stapia siê w bezwarto¶ciow± bry³kê.";
}
}
if ( obj->carried_by != NULL )
act( msg, obj->carried_by, obj, NULL, TO_ALL );
else if ( obj->in_room != NULL && obj->in_room->people != NULL )
act( msg, obj->in_room->people, obj, NULL, TO_ALL );
/* get rid of the object */
if ( obj->contains ) /* dump contents */
{
for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
{
n_obj = t_obj->next_content;
obj_from_obj( t_obj );
if ( obj->in_room != NULL )
obj_to_room( t_obj, obj->in_room );
else if ( obj->carried_by != NULL )
obj_to_room( t_obj, obj->carried_by->in_room );
else
{
/*artefact*/
if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( t_obj );
continue;
}
shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
}
}
/*artefact*/
if ( is_artefact( obj ) ) extract_artefact( obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( obj );
return ;
}
}
void sound_effect( void *vo, int level, int dam, int target )
{
if ( target == TARGET_CHAR )
{
CHAR_DATA * victim = ( CHAR_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
AFFECT_DATA af;
if ( !victim->in_room )
return ;
/* jesli ma uszy moze ogluchnac */
if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_EAR ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) &&
!is_undead( victim ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) &&
!IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) &&
!IS_AFFECTED( victim, AFF_DEAFNESS ) &&
!IS_AFFECTED( victim, AFF_PERFECT_SENSES ) )
{
if ( number_percent() < dam - victim->resists[RESIST_SOUND] )
{
af.where = TO_AFFECTS;
af.type = 169;
af.level = level;
af.duration = 3;
af.rt_duration = 0;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = &AFF_DEAFNESS;
affect_to_char( victim, &af, NULL, TRUE );
send_to_char( "Ból w uszach potêguje siê coraz bardziej, a g³osy wokó³ ciebie nagle milkn±.\n\r", victim );
act( "Z uszu $z wyp³ywa stru¿ka krwi.", victim, NULL, NULL, TO_ROOM );
}
}
if ( is_affected(victim, gsn_mirrorfall) )
{
affect_strip(victim, gsn_mirrorfall);
return;
}
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
sound_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
else if ( target == TARGET_OBJ )
{
OBJ_DATA * obj = ( OBJ_DATA * ) vo;
OBJ_DATA *t_obj, *n_obj;
/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
return;*/
if ( !check_item_resist( obj, RESIST_SOUND, dam+level ) )
return;
if ( obj->carried_by != NULL )
{
if( obj->liczba_mnoga)
act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
else
act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
}
else if ( obj->in_room != NULL && obj->in_room->people != NULL )
{
if( obj->liczba_mnoga)
act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
else
act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
}
if ( obj->contains )
{
for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
{
n_obj = t_obj->next_content;
obj_from_obj( t_obj );
if ( obj->in_room != NULL )
obj_to_room( t_obj, obj->in_room );
else if ( obj->carried_by != NULL )
obj_to_room( t_obj, obj->carried_by->in_room );
else
{
/*artefact*/
if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( t_obj );
continue;
}
shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
}
}
/*artefact*/
if ( is_artefact( obj ) ) extract_artefact( obj );
if ( obj->contains ) extract_artefact_container( obj );
extract_obj( obj );
return ;
}
else if ( target == TARGET_ROOM )
{
ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
OBJ_DATA *obj, *obj_next;
for ( obj = room->contents; obj != NULL; obj = obj_next )
{
OBJ_NEXT_CONTENT( obj, obj_next );
sound_effect( obj, level, dam, TARGET_OBJ );
}
return ;
}
return;
}