givit() tries to give you an intrinsic based on the monster's level * and what type of intrinsic it is trying to give you. */
| 1000 | * and what type of intrinsic it is trying to give you. |
| 1001 | */ |
| 1002 | staticfn void |
| 1003 | givit(int type, struct permonst *ptr) |
| 1004 | { |
| 1005 | debugpline1("Attempting to give intrinsic %d", type); |
| 1006 | |
| 1007 | if (!should_givit(type, ptr) && !temp_givit(type, ptr)) |
| 1008 | return; |
| 1009 | |
| 1010 | switch (type) { |
| 1011 | case FIRE_RES: |
| 1012 | debugpline0("Trying to give fire resistance"); |
| 1013 | if (!(HFire_resistance & FROMOUTSIDE)) { |
| 1014 | You(Hallucination ? "be chillin'." : "feel a momentary chill."); |
| 1015 | HFire_resistance |= FROMOUTSIDE; |
| 1016 | } |
| 1017 | break; |
| 1018 | case SLEEP_RES: |
| 1019 | debugpline0("Trying to give sleep resistance"); |
| 1020 | if (!(HSleep_resistance & FROMOUTSIDE)) { |
| 1021 | You_feel("wide awake."); |
| 1022 | HSleep_resistance |= FROMOUTSIDE; |
| 1023 | } |
| 1024 | break; |
| 1025 | case COLD_RES: |
| 1026 | debugpline0("Trying to give cold resistance"); |
| 1027 | if (!(HCold_resistance & FROMOUTSIDE)) { |
| 1028 | You_feel("full of hot air."); |
| 1029 | HCold_resistance |= FROMOUTSIDE; |
| 1030 | } |
| 1031 | break; |
| 1032 | case DISINT_RES: |
| 1033 | debugpline0("Trying to give disintegration resistance"); |
| 1034 | if (!(HDisint_resistance & FROMOUTSIDE)) { |
| 1035 | You_feel(Hallucination ? "totally together, man." : "very firm."); |
| 1036 | HDisint_resistance |= FROMOUTSIDE; |
| 1037 | } |
| 1038 | break; |
| 1039 | case SHOCK_RES: /* shock (electricity) resistance */ |
| 1040 | debugpline0("Trying to give shock resistance"); |
| 1041 | if (!(HShock_resistance & FROMOUTSIDE)) { |
| 1042 | if (Hallucination) |
| 1043 | You_feel("grounded in reality."); |
| 1044 | else |
| 1045 | Your("health currently feels amplified!"); |
| 1046 | HShock_resistance |= FROMOUTSIDE; |
| 1047 | } |
| 1048 | break; |
| 1049 | case POISON_RES: |
| 1050 | debugpline0("Trying to give poison resistance"); |
| 1051 | if (!(HPoison_resistance & FROMOUTSIDE)) { |
| 1052 | You_feel(Poison_resistance ? "especially healthy." : "healthy."); |
| 1053 | HPoison_resistance |= FROMOUTSIDE; |
| 1054 | } |
| 1055 | break; |
| 1056 | case TELEPORT: |
| 1057 | debugpline0("Trying to give teleport"); |
| 1058 | if (!(HTeleportation & FROMOUTSIDE)) { |
| 1059 | You_feel(Hallucination ? "diffuse." : "very jumpy."); |
no test coverage detected