Skip to content

Instantly share code, notes, and snippets.

/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
// parry chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind && (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_PARRY)))
{
tmp = parry_chance - skillBonus;
// check if unit _can_ parry
if (roll < (sum += tmp))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY %d)", tmp);
return MELEE_HIT_PARRY;
// parry chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind)
{
tmp = parry_chance - skillBonus;
// check if unit _can_ parry
if ((pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_PARRY)) && roll < (sum += tmp))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY %d)", tmp);
return MELEE_HIT_PARRY;
@dagochen
dagochen / gist:bf003c3175db0f4739d08d3f5290ac2f
Created August 13, 2016 22:26
Gameobject XYZ to Area and Zone
void ObjectMgr::WriteGameObjectTextFile()
{
bool stop = false;
if (stop)
return;
std::ofstream myfile;
myfile.open("gameobjects.txt");
for (uint32 i = 1; i < mGameObjectDataMap.size(); i++)