Well, I tried it out and this is the result. Not sure if it is unbalanced, but it works.
Here is the code, it is all you need:
gear.h:
ITEM(tamingwhip, whip)
{
public:
virtual truth HitEffect(character*, character*, v2, int, int, truth);
protected:
virtual truth NefasHelps(ccharacter*, ccharacter*) const;
};
gear.cpp
truth tamingwhip::HitEffect(character* Enemy, character* Hitter, v2 HitPos, int BodyPartIndex, int Direction, truth BlockedByArmour)
{
truth BaseSuccess = meleeweapon::HitEffect(Enemy, Hitter, HitPos, BodyPartIndex, Direction, BlockedByArmour);
if(!IsBroken() && Enemy->IsEnabled() && NefasHelps(Enemy, Hitter)) // need to work out if nefas can help
{
if(Enemy->IsPlayer() || Hitter->IsPlayer() || Enemy->CanBeSeenByPlayer() || Hitter->CanBeSeenByPlayer())
{
ADD_MESSAGE("%s whip asks for the help of Nefas as it tames %s.", Hitter->CHAR_PERSONAL_PRONOUN, Enemy->CHAR_DESCRIPTION(DEFINITE));
if(Enemy->CanTameWithWhip(Hitter))
{
if(Enemy->GetTeam() == Hitter->GetTeam())
ADD_MESSAGE("%s seems to be very happy.", Enemy->CHAR_NAME(DEFINITE));
else if(Enemy->GetRelation(Hitter) == HOSTILE)
ADD_MESSAGE("%s stops fighting.", Enemy->CHAR_NAME(DEFINITE));
else
ADD_MESSAGE("%s seems to be very friendly towards you.", Enemy->CHAR_NAME(DEFINITE));
Enemy->ChangeTeam(Hitter->GetTeam());
}
else
ADD_MESSAGE("%s refuses to be mastered by the whip.", Enemy->CHAR_NAME(DEFINITE));
}
if(Hitter->IsPlayer())
{
game::DoEvilDeed(20);
game::GetGod(NEFAS)->AdjustRelation(10);
}
return true;
}
else
return BaseSuccess;
}
truth tamingwhip::NefasHelps(ccharacter* Enemy, ccharacter* Hitter) const
{
if(Hitter->IsPlayer())
{
if(game::GetGod(NEFAS)->GetRelation() < 0) // must have positive relation
return false;
else
return !(RAND() % (20 - game::GetGod(NEFAS)->GetRelation() / 150)); // return a chance to proceed
}
else
return !(RAND() % 20); // there is always a remote chance
}
char.h:
truth CanTameWithWhip(const character*) const;
char.cpp
truth character::CanTameWithWhip(const character* Tamer) const
{
int TamingDifficulty = GetTamingDifficulty();
if(TamingDifficulty == NO_TAMING)
return false;
int Modifier = Tamer->GetAttribute(DEXTERITY) + Tamer->GetAttribute(CHARISMA);
if(Tamer->IsPlayer())
Modifier += game::GetGod(NEFAS)->GetRelation() / 20;
else if(Tamer->GetAttachedGod() == NEFAS)
Modifier += 50;
if(TamingDifficulty == 0)
if(!IgnoreDanger())
TamingDifficulty = int(10 * GetRelativeDanger(Tamer));
else
TamingDifficulty = 10 * GetHPRequirementForGeneration()
/ Max(Tamer->GetHP(), 1);
return Modifier >= TamingDifficulty * 3;
}
script.dat
tamingwhip /* meleeweapon->whip-> */
{
DefaultSize = 250;
Possibility = 10;
DefaultMainVolume = 1200;
DefaultSecondaryVolume = 50;
StrengthModifier = 20;
NameSingular = "whip of taming";
MainMaterialConfig == BLACK_LEATHER;
SecondaryMaterialConfig == ROSE_QUARTZ;
Roundness = 2;
FormModifier = 20; /* this is multiplied by MainMaterial's flexibility */
Price = 800;
AttachedGod = NEFAS;
WieldedBitmapPos = 160, 224;
EnchantmentMinusChance = 50;
EnchantmentPlusChance = 50;
}
EDIT: Just like to say, there's an horrifyingly unbalanced bug in the above code. Here's a clue: Think about what will happen if a mistress successfully tames the player character...