void infuscor::PrayBadEffect() { truth Success = false; if(GetRelation() < -200) { uint c; for(c = 1; c < uint(PLAYER->GetBodyParts()); ++c) // annoying :( { bodypart* BodyPart = PLAYER->GetBodyPart(c); if(BodyPart && BodyPart->IsDestroyable(PLAYER)) if(BodyPart->GetMainMaterial()) if(BodyPart->CanBeBurned() && (BodyPart->GetMainMaterial()->GetInteractionFlags() & CAN_BURN) && !BodyPart->IsBurning()) { if(BodyPart->TestActivationEnergy(50)) { Success = true; } } } if(Success) ADD_MESSAGE("\"I'm going to enjoy watching you burn, insolent mortal!\""); } ADD_MESSAGE("Vile and evil knowledge pumps into your brain. It's too much for you to handle; you faint."); PLAYER->LoseConsciousness(1000 + RAND_N(1000)); }
AI::Relation AI::relationTo(const ServerPlayer *other) const { if (self == other) return Friend; const Scenario *scenario = room->getScenario(); if (scenario) return scenario->relationTo(self, other); return GetRelation(self, other); }
AI::Relation AI::relationTo(const ServerPlayer *other) const { if (self == other) return Friend; const Scenario *scenario = room->getScenario(); if (scenario) return scenario->relationTo(self, other); if (room->getMode() == "06_3v3" || room->getMode() == "06_XMode") return GetRelation3v3(self, other); return GetRelation(self, other); }
AI::Relation AI::relationTo(const ServerPlayer *other) const{ if(self == other) return Friend; const Scenario *scenario = room->getScenario(); if(scenario) return scenario->relationTo(self, other); if(room->getMode() == "06_3v3") return GetRelation3v3(self, other); else if(Config.EnableHegemony) return GetRelationHegemony(self, other); return GetRelation(self, other); }
int GetRelation(UnitAny* unit) { UnitAny* player = D2CLIENT_GetPlayerUnit(); RosterUnit* roster; RosterUnit* playerRoster = FindPlayerRoster(player->dwUnitId); //Neutral = 2, Partied = 3, You = 1, Hostile = 4 if (!unit || !player) return 2; switch(unit->dwType) { case UNIT_PLAYER://Player // Check if we are the unit. if (unit->dwUnitId == player->dwUnitId) return 1;//You // Check if we are in a party with unit. roster = FindPlayerRoster(unit->dwUnitId); if (playerRoster && roster && playerRoster->wPartyId == roster->wPartyId && roster->wPartyId != INVALID_PARTY_ID) return 3;//Partied // Check if unit is hostile towards us if (TestPvpFlag_STUB(unit->dwUnitId, player->dwUnitId, 8)) return 4; return 2; break; case UNIT_MONSTER://Monster or NPC or Summon case UNIT_MISSILE://Missile if (unit->dwOwnerId < 0 || unit->dwOwnerType < 0 || unit->dwOwnerType > 5) return 4; if (unit->dwType == UNIT_MONSTER && unit->dwOwnerType == UNIT_MONSTER) return 4; // Find the owner of the unit. UnitAny* owner = D2CLIENT_FindServerSideUnit(unit->dwOwnerId, unit->dwOwnerType); if (!owner || owner->dwType != unit->dwOwnerType || owner->dwUnitId != unit->dwOwnerId) return 4; return GetRelation(owner); break; } return 2;//Neutral }
void atavus::PrayGoodEffect() { item* Enchantable; item* PairEnchantable; int LowEnchant = 99; truth Pair = false; for(int c = 0; c < PLAYER->GetEquipments(); ++c) { item* Equipment = PLAYER->GetEquipment(c); if(Equipment && Equipment->CanBeEnchanted() && !Equipment->IsWeapon(PLAYER) && (Equipment->GetEnchantment() < LowEnchant)) { Enchantable = Equipment; LowEnchant = Enchantable->GetEnchantment(); Pair = false; continue; } if(Enchantable && Equipment && Equipment->HandleInPairs() && Equipment->CanBePiledWith(Enchantable, PLAYER)) { Pair = true; PairEnchantable = Equipment; } } if(LowEnchant < 99) { int EnchDiff = ((Enchantable->GetEnchantment()+2)*250 - GetRelation()) / 50; if(EnchDiff <= 1 || !RAND_N(EnchDiff)) { if(Pair) { ADD_MESSAGE("Your %s glow briefly blue. They feel very warm now.", Enchantable->CHAR_NAME(PLURAL)); Enchantable->EditEnchantment(1); PairEnchantable->EditEnchantment(1); } else { ADD_MESSAGE("Your %s glows briefly blue. It feels very warm now.", Enchantable->CHAR_NAME(UNARTICLED)); Enchantable->EditEnchantment(1); } return; } } ADD_MESSAGE("You feel that %s is watching your actions closely.", GetName()); }
void sophos::PrayGoodEffect() { if(!PLAYER->StateIsActivated(TELEPORT_LOCK)) { ADD_MESSAGE("Suddenly, the fabric of space experiences an unnaturally powerful quantum displacement!"); game::AskForKeyPress(CONST_S("You teleport! [press any key to continue]")); PLAYER->Move(game::GetCurrentLevel()->GetRandomSquare(PLAYER), true); } // Give a little attribute experience (Cha already given by Dulcis and not Wis, // as we want to check Wis to give the experience). if(PLAYER->GetAttribute(WISDOM) > RAND_128) { cchar* SecretType; int Experience = Min(200, Max(50, GetRelation() / 4)); switch(RAND() % 2) { case 0: SecretType = "an ancient"; PLAYER->EditExperience(INTELLIGENCE, Experience, 1 << 10); break; case 1: SecretType = "a terrible"; PLAYER->EditExperience(WILL_POWER, Experience, 1 << 10); break; case 2: SecretType = "a profound"; PLAYER->EditExperience(MANA, Experience, 1 << 10); break; default: SecretType = "a weird and disturbing"; break; } ADD_MESSAGE("%s whispers %s secret to you.", GetName(), SecretType); } else { ADD_MESSAGE("You hear a booming voice: \"Alas, I cannot help thee, mortal.\""); } return; }
void cleptia::PrayGoodEffect() { int Duration = 200 * PLAYER->GetAttribute(WISDOM) + Max(Relation, 0); PLAYER->RestoreStamina(); if(PLAYER->StateIsActivated(SLOW)) { ADD_MESSAGE("%s restores the swiftness of your movement.", GetName()); PLAYER->DeActivateTemporaryState(SLOW); return; } if(!PLAYER->StateIsActivated(HASTE)) { ADD_MESSAGE("%s gives you the talent for speed.", GetName()); PLAYER->BeginTemporaryState(HASTE, Duration); return; } if(!PLAYER->StateIsActivated(INVISIBLE)) { ADD_MESSAGE("%s hides you from your enemies.", GetName()); PLAYER->BeginTemporaryState(INVISIBLE, Duration); return; } if(!PLAYER->StateIsActivated(INFRA_VISION)) { ADD_MESSAGE("%s orders darkness to hinder you no more.", GetName()); PLAYER->BeginTemporaryState(INFRA_VISION, Duration); return; } // Nothing else helped so far. int Experience = Min(200, Max(50, GetRelation() / 4)); int WhichAttribute = RAND() & 1 ? DEXTERITY : AGILITY; PLAYER->EditExperience(WhichAttribute, Experience, 1 << 10); ADD_MESSAGE("%s helps you, but you really don't know how.", GetName()); return; }
bool SWTypeExt::ExtData::IsHouseAffected(HouseClass* pFirer, HouseClass* pHouse, SuperWeaponAffectedHouse::Value value) { SuperWeaponAffectedHouse::Value relation = GetRelation(pFirer, pHouse); return (value & relation) == relation; }
// can i see the animation of pFirer's SW? bool SWTypeExt::ExtData::IsAnimVisible(HouseClass* pFirer) { SuperWeaponAffectedHouse::Value relation = GetRelation(pFirer, HouseClass::Player); return (this->SW_AnimVisibility & relation) == relation; }
void team::Hostility(team* Enemy) { /* We're testing if the game works better this way... */ if(ID != PLAYER_TEAM) return; if(this != Enemy && GetRelation(Enemy) != HOSTILE) { if(ID == PLAYER_TEAM && game::IsSumoWrestling()) game::EndSumoWrestling(DISQUALIFIED); /* This is a gum solution. The behaviour should come from the script. */ /*if(ID == COLONIST_TEAM && Enemy->ID == NEW_ATTNAM_TEAM) return;*/ game::Hostility(this, Enemy); if(ID == PLAYER_TEAM) { if(Enemy->ID == ATTNAM_TEAM) { /* This is a gum solution. The message should come from the script. */ if(PLAYER->CanHear()) ADD_MESSAGE("You hear an alarm ringing."); if(game::GetStoryState() != 2) { v2 AngelPos = game::GetPetrus() ? game::GetPetrus()->GetPos() : v2(28, 20); int Seen = 0; angel* Angel; for(int c = 0; c < 3; ++c) { if(!c) Angel = archangel::Spawn(VALPURUS); else Angel = angel::Spawn(VALPURUS); v2 Where = game::GetCurrentLevel()->GetNearestFreeSquare(Angel, AngelPos); if(Where == ERROR_V2) Where = game::GetCurrentLevel()->GetRandomSquare(Angel); Angel->SetTeam(Enemy); Angel->PutTo(Where); if(Angel->CanBeSeenByPlayer()) ++Seen; } if(Seen == 1) ADD_MESSAGE("%s materializes.", Angel->CHAR_NAME(INDEFINITE)); else if(Seen == 2) ADD_MESSAGE("Two %s materialize.", Angel->CHAR_NAME(PLURAL)); else if(Seen == 3) ADD_MESSAGE("Three %s materialize.", Angel->CHAR_NAME(PLURAL)); ADD_MESSAGE("\"We will defend the Holy Order!\""); } } ADD_MESSAGE("You have a feeling this wasn't a good idea..."); } SetRelation(Enemy, HOSTILE); } }
void legifer::PrayGoodEffect() { // I think this is a remnant of past development that you call upon Inlux rather than Legifer. --red_kangaroo ADD_MESSAGE("A booming voice echoes: \"Inlux! Inlux! Save us!\" A huge firestorm engulfs everything around you."); //ADD_MESSAGE("You are surrounded by the righteous flames of %s.", GetName()); game::GetCurrentLevel()->Explosion(PLAYER, CONST_S("killed by the holy flames of ") + GetName(), PLAYER->GetPos(), (Max(20 * PLAYER->GetAttribute(WISDOM), 1) + Max(GetRelation(), 0)) >> 3, false); }
void dulcis::PrayGoodEffect() { truth HasHelped = false; for(int d = 0; d < PLAYER->GetNeighbourSquares(); ++d) { square* Square = PLAYER->GetNeighbourSquare(d); if(Square) { character* Char = Square->GetCharacter(); if(Char) if(Char->IsBurning()) if(Char->GetTeam() == PLAYER->GetTeam()) { Char->Extinguish(true); HasHelped = true; } } } if(PLAYER->IsBurning()) { PLAYER->Extinguish(true); if(HasHelped) ADD_MESSAGE("Dulcis helps you and your companions to put out the flames."); else ADD_MESSAGE("Dulcis helps you to put out the flames."); HasHelped = true; } else if(HasHelped) ADD_MESSAGE("Dulcis helps your companions to put out the flames."); if(HasHelped) return; else ADD_MESSAGE("A beautiful melody echoes around you."); for(int d = 0; d < PLAYER->GetNeighbourSquares(); ++d) { square* Square = PLAYER->GetNeighbourSquare(d); if(Square) { character* Char = Square->GetCharacter(); if(Char) { if(Char->CanHear()) if(Char->CanTameWithDulcis(PLAYER)) { if(Char->GetTeam() == PLAYER->GetTeam()) ADD_MESSAGE("%s seems to be very happy.", Char->CHAR_DESCRIPTION(DEFINITE)); else if(Char->GetRelation(PLAYER) == HOSTILE) { ADD_MESSAGE("%s stops fighting.", Char->CHAR_DESCRIPTION(DEFINITE)); HasHelped = true; } else ADD_MESSAGE("%s seems to be very friendly towards you.", Char->CHAR_DESCRIPTION(DEFINITE)); Char->ChangeTeam(PLAYER->GetTeam()); } else { ADD_MESSAGE("%s resists its charming call.", Char->CHAR_DESCRIPTION(DEFINITE)); if(Char->GetRelation(PLAYER) == HOSTILE) HasHelped = true; } else { ADD_MESSAGE("%s seems not affected.", Char->CHAR_DESCRIPTION(DEFINITE)); if(Char->GetRelation(PLAYER) == HOSTILE) HasHelped = true; } } } } if(HasHelped) return; if (GetRelation() >= 50) { ADD_MESSAGE("You feel the music resonate within you.", GetName()); int Experience = Min(200, Max(75, GetRelation()/4)); PLAYER->EditExperience(CHARISMA, Experience, 33335); } }
void cruentus::PrayGoodEffect() { rect Rect; femath::CalculateEnvironmentRectangle(Rect, game::GetCurrentLevel()->GetBorder(), PLAYER->GetPos(), 10); truth AudiencePresent = false; for(int x = Rect.X1; x <= Rect.X2; ++x) { for(int y = Rect.Y1; y <= Rect.Y2; ++y) { character* Audience = game::GetCurrentLevel()->GetSquare(x, y)->GetCharacter(); if(Audience && Audience->CanBeSeenByPlayer() && !Audience->TemporaryStateIsActivated(PANIC) && PLAYER->GetRelation(Audience) == HOSTILE) { AudiencePresent = true; break; } } if(AudiencePresent) break; } if(AudiencePresent) { ADD_MESSAGE("The thundering voice of a godly battle drum shakes everything around you."); for(int x = Rect.X1; x <= Rect.X2; ++x) for(int y = Rect.Y1; y <= Rect.Y2; ++y) { character* Audience = game::GetCurrentLevel()->GetSquare(x, y)->GetCharacter(); if(Audience && !Audience->TemporaryStateIsActivated(PANIC) && PLAYER->GetRelation(Audience) == HOSTILE && Audience->GetPanicLevel() > RAND() % 33) Audience->BeginTemporaryState(PANIC, 500 + RAND() % 500); } return; } item* Weapon = PLAYER->GetMainWielded(); for(int i = 0; i < 2; i++) { if(Weapon && Weapon->IsWeapon(PLAYER) && Weapon->CanBeEnchanted()) { int EnchDiff = (Weapon->GetEnchantment()*250 - GetRelation()) / 50; if (EnchDiff <= 1 || !RAND_N(EnchDiff)) { ADD_MESSAGE("Your %s glows briefly red. It feels very warm now.", Weapon->CHAR_NAME(UNARTICLED)); Weapon->EditEnchantment(1); return; } } Weapon = PLAYER->GetSecondaryWielded(); } if(RAND() & 3) { potion* Bottle = potion::Spawn(0, NO_MATERIALS); Bottle->InitMaterials(MAKE_MATERIAL(GLASS), MAKE_MATERIAL(TROLL_BLOOD)); PLAYER->GetGiftStack()->AddItem(Bottle); ADD_MESSAGE("%s drops from nowhere.", Bottle->CHAR_DESCRIPTION(INDEFINITE)); } else { ADD_MESSAGE("Cruentus recommends you to his master, Mortifer."); game::GetGod(MORTIFER)->AdjustRelation(100); } }
void infuscor::PrayGoodEffect() { truth Success = false; rect Rect; femath::CalculateEnvironmentRectangle(Rect, game::GetCurrentLevel()->GetBorder(), PLAYER->GetPos(), PLAYER->GetESPRange()); for(int x = Rect.X1; x <= Rect.X2; ++x) { for(int y = Rect.Y1; y <= Rect.Y2; ++y) { character* Victim = game::GetCurrentLevel()->GetSquare(x, y)->GetCharacter(); if(Victim && Victim->CanBeSeenByPlayer() && PLAYER->GetRelation(Victim) == HOSTILE) { uint c; truth Burned = false; for(c = 1; c < uint(Victim->GetBodyParts()); ++c) // annoying :( { bodypart* BodyPart = Victim->GetBodyPart(c); if(BodyPart && BodyPart->IsDestroyable(Victim) && BodyPart->GetMainMaterial() && BodyPart->CanBeBurned() && (BodyPart->GetMainMaterial()->GetInteractionFlags() & CAN_BURN) && !BodyPart->IsBurning()) { if(BodyPart->TestActivationEnergy(20 + GetRelation() / 10)) { Success = true; Burned = true; } } } if(Burned) ADD_MESSAGE("%s savagely sets fire to %s!", GetName(), Victim->CHAR_DESCRIPTION(DEFINITE)); } } } if(!Success) { int Duration = 5000 + Relation * 15; if(!PLAYER->StateIsActivated(ESP) || PLAYER->GetTemporaryStateCounter(ESP) < Duration) { if(!PLAYER->StateIsActivated(ESP)) PLAYER->BeginTemporaryState(ESP, Duration); else PLAYER->EditTemporaryStateCounter(ESP, PLAYER->GetTemporaryStateCounter(ESP)+Duration); ADD_MESSAGE("You feel %s whisper in your mind.", GetName()); return; } if(!PLAYER->StateIsActivated(POLYMORPH_CONTROL) || PLAYER->GetTemporaryStateCounter(POLYMORPH_CONTROL) < Duration) { if(!PLAYER->StateIsActivated(POLYMORPH_CONTROL)) PLAYER->BeginTemporaryState(POLYMORPH_CONTROL, Duration); else PLAYER->EditTemporaryStateCounter(POLYMORPH_CONTROL, PLAYER->GetTemporaryStateCounter(POLYMORPH_CONTROL)+Duration); ADD_MESSAGE("You feel %s whisper throughout your whole body.", GetName()); return; } } }
void legifer::PrayGoodEffect() { ADD_MESSAGE("A booming voice echoes: \"Inlux! Inlux! Save us!\" A huge firestorm engulfs everything around you."); game::GetCurrentLevel()->Explosion(PLAYER, CONST_S("killed by the holy fire of ") + GetName(), PLAYER->GetPos(), (300 + Max(GetRelation(), 0)) >> 3, false); }
void loricatus::PrayGoodEffect() { item* MainWielded = PLAYER->GetMainWielded(); if(MainWielded) { if(MainWielded->IsMaterialChangeable() && MainWielded->GetMainMaterial()->GetAttachedGod() == GetType()) { int Config = MainWielded->GetMainMaterial()->GetHardenedMaterial(MainWielded); if(Config) { int IR = material::GetDataBase(Config)->IntelligenceRequirement - GetRelation() / 50; if(IR <= 1 || !RAND_N(IR)) { festring Desc; item* SecondaryWielded; if(MainWielded->HandleInPairs() && (SecondaryWielded = PLAYER->GetSecondaryWielded()) && SecondaryWielded->CanBePiledWith(MainWielded, PLAYER)) { MainWielded->AddName(Desc, PLURAL); Desc << " glow and sparkle like they were"; if(SecondaryWielded->GetSecondaryMaterial() && SecondaryWielded->GetSecondaryMaterial()->IsSameAs(MainWielded->GetMainMaterial())) SecondaryWielded->ChangeSecondaryMaterial(MAKE_MATERIAL(Config)); SecondaryWielded->ChangeMainMaterial(MAKE_MATERIAL(Config)); } else { MainWielded->AddName(Desc, UNARTICLED); Desc << " glows and sparkles like it was"; } if(MainWielded->GetSecondaryMaterial() && MainWielded->GetSecondaryMaterial()->IsSameAs(MainWielded->GetMainMaterial())) MainWielded->ChangeSecondaryMaterial(MAKE_MATERIAL(Config)); MainWielded->ChangeMainMaterial(MAKE_MATERIAL(Config)); ADD_MESSAGE("Your %s reforged by invisible hands.", Desc.CStr()); return; } } if(!(RAND() % 10)) { item* Scroll = scrollofrepair::Spawn(); ADD_MESSAGE("%s gives you %s.", GetName(), Scroll->CHAR_NAME(INDEFINITE)); PLAYER->GetGiftStack()->AddItem(Scroll); return; } else ADD_MESSAGE("\"Mortal, thou art always my valiant knight!\""); } } for(int c = 0; c < PLAYER->GetEquipments(); ++c) { item* Equipment = PLAYER->GetEquipment(c); if(Equipment && Equipment->IsBroken()) { ADD_MESSAGE("%s fixes your %s.", GetName(), Equipment->CHAR_NAME(UNARTICLED)); Equipment->Fix(); return; } } if(PLAYER->GetUsableArms()) ADD_MESSAGE("You feel a slight tingling in your hands."); else ADD_MESSAGE("You feel a slight tingle."); }
void nefas::PrayGoodEffect() { rect Rect; femath::CalculateEnvironmentRectangle(Rect, game::GetCurrentLevel()->GetBorder(), PLAYER->GetPos(), 10); truth AudiencePresent = false; for(int x = Rect.X1; x <= Rect.X2; ++x) { for(int y = Rect.Y1; y <= Rect.Y2; ++y) { character* Audience = game::GetCurrentLevel()->GetSquare(x, y)->GetCharacter(); if(Audience && Audience->CanBeSeenByPlayer() && !Audience->TemporaryStateIsActivated(CONFUSED) && Audience->CanBeConfused() && PLAYER->GetRelation(Audience) == HOSTILE) { AudiencePresent = true; break; } } if(AudiencePresent) break; } if(AudiencePresent) { for(int x = Rect.X1; x <= Rect.X2; ++x) for(int y = Rect.Y1; y <= Rect.Y2; ++y) { character* Audience = game::GetCurrentLevel()->GetSquare(x, y)->GetCharacter(); if(Audience && !Audience->TemporaryStateIsActivated(CONFUSED) && Audience->CanBeConfused() && PLAYER->GetRelation(Audience) == HOSTILE) { if(Audience->CanBeSeenByPlayer()) ADD_MESSAGE("%s confuses %s with her sweet lies.", GetName(), Audience->CHAR_NAME(DEFINITE)); Audience->BeginTemporaryState(CONFUSED, 500 + RAND() % 500); } } } if((GetRelation() > 200) && RAND_N(5)) { int Chief = 3000/GetRelation(); mistress* Mistress = mistress::Spawn(RAND_N(Chief) ? 0 : TORTURING_CHIEF); v2 Where = game::GetCurrentLevel()->GetNearestFreeSquare(Mistress, PLAYER->GetPos()); if(Where == ERROR_V2) { if(PLAYER->CanHear()) ADD_MESSAGE("You hear a strange scream from somewhere beneath."); else ADD_MESSAGE("You feel the air vibrating."); delete Mistress; } else { Mistress->SetTeam(PLAYER->GetTeam()); Mistress->PutTo(Where); ADD_MESSAGE("You hear a sweet voice inside your head: \"Have fun, mortal!\""); } } else { ADD_MESSAGE("You hear a sweet voice inside your head: \"Enjoy, mortal!\"."); potion* Bottle = potion::Spawn(0, NO_MATERIALS); Bottle->InitMaterials(MAKE_MATERIAL(GLASS), MAKE_MATERIAL(VODKA)); PLAYER->GetGiftStack()->AddItem(Bottle); ADD_MESSAGE("%s drops from nowhere.", Bottle->CHAR_DESCRIPTION(INDEFINITE)); } }