Attached Files |
silver_moon.patch [^] (8,211 bytes) 2013-06-12 13:55 [Show Content] [Hide Content]diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index 1b0a510..172f56c 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -1068,6 +1068,17 @@ TILE: urand_axe_of_woe
TILE_EQ: axe_of_woe
BOOL: nogen
+NAME: Silver Moon
+OBJ: OBJ_WEAPONS/WPN_LAJATANG
+PLUS: +7/+7
+COLOUR: ETC_SILVER
+TILE: unrand_silver_moon
+TILE_EQ: silver_moon
+BOOL: special, elec
+STEALTH: -10
+MAGIC: 20
+
+
# This is the first of two amulets used to test suppression aura.
# Together, they confer every randart effect except for a few that are
# determined explicitly by checking whether a certain amulet is worn
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index 4ebb834..b56683a 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -817,3 +817,120 @@ static void _WOE_melee_effect(item_def* weapon, actor* attacker,
if (!mondied)
defender->hurt(attacker, defender->stat_hp());
}
+
+///////////////////////////////////////////////////
+
+
+static void _silver_moon_charges(item_def* item, unsigned exp)
+{
+
+ int xp_factor = max(min((int)exp_needed(you.experience_level+1, 0) * 2 / 7,
+ you.experience_level * 425),
+ you.experience_level*4 + 30)
+ / (3 + you.skill_rdiv(SK_EVOCATIONS, 2, 7));
+
+ item->props["sm_charge_pool"].get_int() += div_rand_round(exp, xp_factor);
+ while (item->props["sm_charge_pool"].get_int() >= 3)
+ {
+
+ item->props["sm_charge_pool"].get_int() -= 3;
+ bool waining = item->props["sm_waining"].get_bool();
+
+
+ if (waining && item->plus == 7)
+ {
+ if (item->props["sm_charges"].get_byte() <7)
+ item->props["sm_charges"].get_byte()++;
+ item->props["sm_waining"].get_bool() = false;
+ item->plus++;
+ item->plus2++;
+ return;
+ }
+
+ if (waining)
+ {
+ item->plus--;
+ item->plus2--;
+ }
+ else
+ {
+ item->plus++;
+ item->plus2++;
+ }
+ if (item->plus == 9)
+ item->props["sm_waining"].get_bool() = true;
+ }
+
+}
+
+static void _SILVER_MOON_melee_effect(item_def* weapon, actor* attacker,
+ actor* defender, bool mondied, int dam)
+{
+ monster* mon = defender->as_monster();
+ bool bonus = mon->is_chaotic() || mon->is_unclean();
+ bool summoned = mon->is_summoned();
+ if (!dam)
+ return;
+ if (mondied)
+ {
+ if (!summoned)
+ _silver_moon_charges(weapon, mon->experience + (bonus ? random2(mon->experience) : 0));
+ return;
+ }
+
+ if (bonus)
+ {
+ mprf("%s is seared by the Silver Moon!",
+ defender->name(DESC_THE).c_str());
+ defender->hurt(attacker, random2avg(1 + dam * 3, 3));
+ }
+ if (!mon->alive()&& !summoned)
+ mpr("<white>The moon-shaped blades glow with silver light.</white>");
+ _silver_moon_charges(weapon, mon->experience + (bonus ? random2(mon->experience) : 0));
+}
+
+
+static bool _SILVER_MOON_evoke(item_def *item, int* pract, bool* did_work,
+ bool* unevokable)
+{
+ if (!item->props.exists("sm_charges"))
+ item->props["sm_charges"].get_byte() = 7;
+
+ char charge = item->props["sm_charges"].get_byte();
+ dprf("Charges left = %d",item->props["sm_charges"].get_byte());
+ if (!charge)
+ {
+ canned_msg(MSG_CANNOT_DO_YET);
+ *unevokable = true;
+ return true;
+ }
+ const int mut = how_mutated(you.species == SP_DEMONSPAWN, false);
+ if (!enough_hp(mut*2, false) || !enough_mp(7, false))
+ {
+
+ *unevokable = true;
+ return true;
+ }
+
+ if (!x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 100, 2500))
+ return false;
+
+ int power = 3 + you.skill(SK_EVOCATIONS, 5);
+
+ power += item->plus - 7;
+
+ if (your_spells(SPELL_SILVER_BLAST, power, false) == SPRET_ABORT)
+ {
+ *unevokable = true;
+ return true;
+ }
+
+ item->props["sm_charges"].get_byte()--;
+
+ make_hungry(250, false, true);
+ dec_mp(7);
+ dec_hp(random2(1 + mut) + random2(1 + mut), false);
+ *pract = 1;
+ *did_work = true;
+
+ return false;
+}
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 4192cbe..14f4ea9 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -35,6 +35,7 @@
#include "spl-book.h"
#include "state.h"
#include "stuff.h"
+#include "mutation.h"
static bool _god_fits_artefact(const god_type which_god, const item_def &item,
bool name_check_only = false)
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index 1673835..250288f 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -460,10 +460,17 @@ As you hold this axe your mind does not feel fully your own. Your body begins
to exhibit strength far beyond its capabilities, and your movements become
guided by Makhleb.
%%%%
+Silver Moon
+
+A Lajatang of pure silver, with the half-moon blades at either end waxing and
+waining very slowly as their wielder uses it to grow in power.
+It allows access to the raw energies contained within to cause great damage
+to the forces of chaos.
+%%%%
milk chocolate
This item is a debugging aid, granting a vast array of mostly beneficial
artefact properties.
If you see this in a real game, it's a bug.
%%%%
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 2377ea7..b859028 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -3636,7 +3636,7 @@ enum zap_type
ZAP_INNER_FLAME,
ZAP_DAZZLING_SPRAY,
ZAP_FORCE_LANCE,
-
+ ZAP_SILVER_BLAST,
+
NUM_ZAPS
};
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 56c67e4..cdd60f3 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -338,7 +338,9 @@ int check_your_resists(int hurted, beam_type flavour, string source,
if (one_chance_in(3)
// delete_mutation() handles MUT_MUTATION_RESISTANCE but not the amulet
&& (!you.rmut_from_item()
- || one_chance_in(10)))
+ || one_chance_in(10))
+ // no removing mutations using UNRAND_SILVER_MOON
+ && !beam->aimed_at_feet)
{
// silver stars only, if this ever changes we may want to give
// aux as well
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index abe3a8e..3106a13 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1098,6 +1098,7 @@ static targetter* _spell_targetter(spell_type spell, int pow, int range)
case SPELL_POLYMORPH:
case SPELL_DIG:
case SPELL_DISPEL_UNDEAD:
+ case SPELL_SILVER_BLAST:
return new targetter_beam(&you, range, spell_to_zap(spell), pow, 0, 0);
default:
return 0;
diff --git a/crawl-ref/source/spl-zap.cc b/crawl-ref/source/spl-zap.cc
index 4a6c3a8..175a631 100644
--- a/crawl-ref/source/spl-zap.cc
+++ b/crawl-ref/source/spl-zap.cc
@@ -108,6 +108,8 @@ zap_type spell_to_zap(spell_type spell)
return ZAP_HOLY_LIGHT;
case SPELL_DEBUGGING_RAY:
return ZAP_DEBUGGING_RAY;
+ case SPELL_SILVER_BLAST:
+ return ZAP_SILVER_BLAST;
default:
return NUM_ZAPS;
}
diff --git a/crawl-ref/source/zap-data.h b/crawl-ref/source/zap-data.h
index 4bb0b3b..b55d903 100644
--- a/crawl-ref/source/zap-data.h
+++ b/crawl-ref/source/zap-data.h
@@ -1083,4 +1083,19 @@ struct zap_info
false,
3
},
+{
+ ZAP_SILVER_BLAST,
+ "blast of silver",
+ 150,
+ new dicedef_calculator<3, 12, 1, 3>,
+ new tohit_calculator<10, 1, 10>,
+ CYAN,
+ false,
+ BEAM_BOLT_OF_ZIN,
+ DCHAR_FIRED_MISSILE,
+ true,
+ false,
+ false,
+ 3
+},
#endif
silver_moon_bolt_of_silver.patch [^] (9,621 bytes) 2013-06-14 08:20 [Show Content] [Hide Content]diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index 1b0a510..172f56c 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -1068,6 +1068,17 @@ TILE: urand_axe_of_woe
TILE_EQ: axe_of_woe
BOOL: nogen
+NAME: Silver Moon
+OBJ: OBJ_WEAPONS/WPN_LAJATANG
+PLUS: +7/+7
+COLOUR: ETC_SILVER
+TILE: unrand_silver_moon
+TILE_EQ: silver_moon
+BOOL: special, elec
+STEALTH: -10
+MAGIC: 20
+
+
# This is the first of two amulets used to test suppression aura.
# Together, they confer every randart effect except for a few that are
# determined explicitly by checking whether a certain amulet is worn
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index 4ebb834..192e8d5 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -817,3 +817,122 @@ static void _WOE_melee_effect(item_def* weapon, actor* attacker,
if (!mondied)
defender->hurt(attacker, defender->stat_hp());
}
+
+///////////////////////////////////////////////////
+
+
+static void _silver_moon_charges(item_def* item, unsigned exp)
+{
+
+ int xp_factor = max(min((int)exp_needed(you.experience_level+1, 0) * 2 / 7,
+ you.experience_level * 425),
+ you.experience_level*4 + 30)
+ / (3 + you.skill_rdiv(SK_EVOCATIONS, 2, 7));
+
+ item->props["sm_charge_pool"].get_int() += div_rand_round(exp, xp_factor);
+ while (item->props["sm_charge_pool"].get_int() >= 3)
+ {
+
+ item->props["sm_charge_pool"].get_int() -= 3;
+ bool waining = item->props["sm_waining"].get_bool();
+
+
+ if (waining && item->plus == 7)
+ {
+ if (item->props["sm_charges"].get_byte() <7)
+ item->props["sm_charges"].get_byte()++;
+ item->props["sm_waining"].get_bool() = false;
+ item->plus++;
+ item->plus2++;
+ return;
+ }
+
+ if (waining)
+ {
+ item->plus--;
+ item->plus2--;
+ }
+ else
+ {
+ item->plus++;
+ item->plus2++;
+ }
+ if (item->plus == 9)
+ item->props["sm_waining"].get_bool() = true;
+ }
+
+}
+
+static void _SILVER_MOON_melee_effect(item_def* weapon, actor* attacker,
+ actor* defender, bool mondied, int dam)
+{
+ monster* mon = defender->as_monster();
+ const bool bonus = mon->is_chaotic();
+ const bool summoned = mon->is_summoned();
+ if (!dam)
+ return;
+ if (mondied)
+ {
+ if (!summoned)
+ _silver_moon_charges(weapon, mon->experience + (bonus ? random2(mon->experience) : 0));
+ return;
+ }
+
+ if (bonus)
+ {
+ mprf("%s is seared by the Silver Moon!",
+ defender->name(DESC_THE).c_str());
+ defender->hurt(attacker, random2avg(1 + dam * 3, 3));
+ }
+ if (!mon->alive()&& !summoned)
+ if (bonus)
+ mpr("<white>The moon-shaped blades glow with silver light.</white>");
+ _silver_moon_charges(weapon, mon->experience + (bonus ? random2(3 * mon->experience) : 0));
+}
+
+
+static bool _SILVER_MOON_evoke(item_def *item, int* pract, bool* did_work,
+ bool* unevokable)
+{
+ if (!item->props.exists("sm_charges"))
+ item->props["sm_charges"].get_byte() = 7;
+
+ char charge = item->props["sm_charges"].get_byte();
+ dprf("Charges left = %d",item->props["sm_charges"].get_byte());
+ if (!charge)
+ {
+ canned_msg(MSG_CANNOT_DO_YET);
+ *unevokable = true;
+ return true;
+ }
+ const int mut = how_mutated(you.species == SP_DEMONSPAWN, false);
+ if (!enough_hp(mut*2, false) || !enough_mp(7, false))
+ {
+
+ *unevokable = true;
+ return true;
+ }
+
+ if (!x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 100, 2500))
+ return false;
+
+ int power = 3 + you.skill(SK_EVOCATIONS, 5);
+
+ power += item->plus - 7;
+
+ if (your_spells(SPELL_BOLT_OF_SILVER, power, false) == SPRET_ABORT)
+ {
+ *unevokable = true;
+ return true;
+ }
+
+ item->props["sm_charges"].get_byte()--;
+
+ make_hungry(250, false, true);
+ dec_mp(6);
+ dec_hp(random2(1 + 2 * mut), false);
+ *pract = 1;
+ *did_work = true;
+
+ return false;
+}
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 4192cbe..14f4ea9 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -35,6 +35,7 @@
#include "spl-book.h"
#include "state.h"
#include "stuff.h"
+#include "mutation.h"
static bool _god_fits_artefact(const god_type which_god, const item_def &item,
bool name_check_only = false)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index e4382ae..549a2b4 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1711,6 +1711,21 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted,
break;
}
+ case BEAM_SILVER:
+ if (mons->is_chaotic())
+ hurted = hurted * 3/ 2;
+ else if (mons->is_holy())
+ hurted =0;
+ else
+ hurted /= 2;
+ if (doFlavouredEffects)
+ {
+ if (hurted > original)
+ simple_monster_message(mons, " is seared!");
+ if (!hurted)
+ simple_monster_message(mons, " is unaffected.");
+
+ }
case BEAM_ICE:
// ice - about 50% of damage is cold, other 50% is impact and
// can't be resisted (except by AC, of course)
@@ -6028,6 +6043,7 @@ static string _beam_type_name(beam_type type)
case BEAM_ENSNARE: return "magic web";
case BEAM_SENTINEL_MARK: return "sentinel's mark";
case BEAM_DIMENSION_ANCHOR: return "dimension anchor";
+ case BEAM_SILVER: return "silver";
case NUM_BEAMS: die("invalid beam type");
}
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index 1673835..250288f 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -460,10 +460,17 @@ As you hold this axe your mind does not feel fully your own. Your body begins
to exhibit strength far beyond its capabilities, and your movements become
guided by Makhleb.
%%%%
+Silver Moon
+
+A Lajatang of pure silver, with the half-moon blades at either end waxing and
+waining very slowly as their wielder uses it to grow in power.
+It allows access to the raw energies contained within to cause great damage
+to the forces of chaos.
+%%%%
milk chocolate
This item is a debugging aid, granting a vast array of mostly beneficial
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 2377ea7..8145e36 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -393,7 +393,8 @@ enum beam_type // bolt::flavour
BEAM_PETRIFYING_CLOUD,
BEAM_BOLT_OF_ZIN,
BEAM_ENSNARE,
- BEAM_LAST_REAL = BEAM_ENSNARE,
+ BEAM_SILVER,
+ BEAM_LAST_REAL = BEAM_SILVER,
// For getting the visual effect of a beam.
BEAM_VISUAL,
@@ -3480,6 +3481,7 @@ enum spell_type
SPELL_CALL_LOST_SOUL,
SPELL_DIMENSION_ANCHOR,
SPELL_BLINK_ALLIES_ENCIRCLE,
+ SPELL_BOLT_OF_SILVER,
+
NUM_SPELLS
};
@@ -3636,7 +3638,8 @@ enum zap_type
ZAP_INNER_FLAME,
ZAP_DAZZLING_SPRAY,
ZAP_FORCE_LANCE,
-
+ ZAP_BOLT_OF_SILVER,
+
NUM_ZAPS
};
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index abe3a8e..a496f79 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1098,6 +1098,7 @@ static targetter* _spell_targetter(spell_type spell, int pow, int range)
case SPELL_POLYMORPH:
case SPELL_DIG:
case SPELL_DISPEL_UNDEAD:
+ case SPELL_BOLT_OF_SILVER:
return new targetter_beam(&you, range, spell_to_zap(spell), pow, 0, 0);
default:
return 0;
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index 83eb526..ff2433c 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -3089,6 +3089,19 @@ struct spell_desc
},
{
+ SPELL_BOLT_OF_SILVER, "Bolt of silver",
+ SPTYP_CONJURATION,
+ SPFLAG_DIR_OR_TARGET,
+ 6,
+ 200,
+ 6, 6,
+ 0,
+ NULL,
+ true,
+ false
+},
+
+{
SPELL_NO_SPELL, "nonexistent spell",
0,
SPFLAG_TESTING,
diff --git a/crawl-ref/source/spl-zap.cc b/crawl-ref/source/spl-zap.cc
index 4a6c3a8..e672b13 100644
--- a/crawl-ref/source/spl-zap.cc
+++ b/crawl-ref/source/spl-zap.cc
@@ -108,6 +108,8 @@ zap_type spell_to_zap(spell_type spell)
return ZAP_HOLY_LIGHT;
case SPELL_DEBUGGING_RAY:
return ZAP_DEBUGGING_RAY;
+ case SPELL_BOLT_OF_SILVER:
+ return ZAP_BOLT_OF_SILVER;
default:
return NUM_ZAPS;
}
diff --git a/crawl-ref/source/zap-data.h b/crawl-ref/source/zap-data.h
index 4bb0b3b..cf6fae5 100644
--- a/crawl-ref/source/zap-data.h
+++ b/crawl-ref/source/zap-data.h
@@ -1083,4 +1083,19 @@ struct zap_info
false,
3
},
+{
+ ZAP_BOLT_OF_SILVER,
+ "blast of silver",
+ 150,
+ new dicedef_calculator<3, 12, 1, 3>,
+ new tohit_calculator<10, 1, 10>,
+ CYAN,
+ false,
+ BEAM_BOLT_OF_ZIN,
+ DCHAR_FIRED_MISSILE,
+ true,
+ true,
+ false,
+ 3
+},
#endif
|