All pastes #886268 Raw Edit

Windfury Weapon

public cpp v1 · immutable
#886268 ·published 2008-01-31 15:49 UTC
rendered paste body
Index: extras/shaman_todo.txt===================================================================--- extras/shaman_todo.txt	(revision 3613)+++ extras/shaman_todo.txt	(working copy)@@ -19,6 +19,14 @@ 		Flametongue Weapon and Frostbrand Weapon by $s2%. 		Windfury Weapon effect by $s3% +Rockbiter - working - untested ?!+Windfury Weapon - working for main hand - untested+Bug: After every? equipment change one has to recast enchantmeants+(Details: Windfury on both weapons, removed off hand, windfury never triggered on main hand)+*/++ [08:51:59] Spell::cast 3050, Unit: 7 [08:51:59] WORLD: Spell effect id = 49, damage = 0 [08:51:59] Unhandled spell effect 49 in spell 3050.Index: src/ascent-world/Player.cpp===================================================================--- src/ascent-world/Player.cpp	(revision 3613)+++ src/ascent-world/Player.cpp	(working copy)@@ -8635,59 +8635,76 @@   } -uint32 Player::GetMainMeleeDamage(uint32 AP_owerride)+uint32 Player::GetShamanMeleeDamage(uint32 AP_override, bool mainHand) {-	float min_dmg,max_dmg;-	float delta;-	float r;-	int ss = GetShapeShift();-/////////////////MAIN HAND-	float ap_bonus;-	if(AP_owerride) -		ap_bonus = AP_owerride/14000.0f;-	else -		ap_bonus = GetAP()/14000.0f;-	delta = (float)GetUInt32Value( PLAYER_FIELD_MOD_DAMAGE_DONE_POS ) - (float)GetUInt32Value( PLAYER_FIELD_MOD_DAMAGE_DONE_NEG );-	if(IsInFeralForm())+	// Currently this is for windfury only+	if( disarmed ) return 0;++	float weaponModifier = 1.0f;+	float ap_bonus = (float)AP_override / 14000.0f;++	float spellEffects = (float) GetUInt32Value( PLAYER_FIELD_MOD_DAMAGE_DONE_POS )+						-(float) GetUInt32Value( PLAYER_FIELD_MOD_DAMAGE_DONE_NEG );+++	Item* weapon = NULL;++	if( mainHand ) 	{-		uint32 lev = getLevel();-		if(ss == FORM_CAT)-			r = lev + delta + ap_bonus * 1000.0f;-		else-			r = lev + delta + ap_bonus * 2500.0f;-		min_dmg = r * 0.9f;-		max_dmg = r * 1.1f;-		return float2int32(std::max((min_dmg + max_dmg)/2.0f,0.0f));+		/*+		main hand formula in CalcDamage()+		((Base0 + spellEffects + ap_bonus·Delay)·weaponModifier + (Base1 + spellEffects + ap_bonus·Delay)·weaponModifier)/2+		+		Derive tells me this is the same as:+		weaponModifier·(Base0 + Base1 + 2·(Delay·ap_bonus + spellEffects))/2+		*/++		weapon = GetItemInterface()->GetInventoryItem( EQUIPMENT_SLOT_MAINHAND );		 	}-//////no druid ss	-	uint32 speed=2000;-	Item *it = GetItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);-	if(!disarmed)-	{	-		if(it)-			speed = it->GetProto()->Delay;+	else+	{+		/*+		off hand forumla in CalcDamage()+		((Base0 + spellEffects + ap_bonus·Delay)·weaponModifier·offhand_dmg_mod + (Base1 + spellEffects + ap_bonus·Delay)·weaponModifier·offhand_dmg_mod)/2++		and again Derive:+		offhand_dmg_mod·weaponModifier·(Base0 + Base1 + 2·Delay·ap_bonus + 2·spellEffects)/2++		as you can see this part is the same on both:+		weaponModifier·(Base0 + Base1 + 2·(Delay·ap_bonus + spellEffects))/2++		so I just "hide" offhand_dmg_mod inside weaponModifier :-)+		*/++		weapon = GetItemInterface()->GetInventoryItem( EQUIPMENT_SLOT_OFFHAND );++		// I hope this is correct+		weaponModifier *= offhand_dmg_mod; 	}-	float bonus=ap_bonus*speed;-	float tmp = 1;+ 	map<uint32, WeaponModifier>::iterator i; 	for(i = damagedone.begin();i!=damagedone.end();i++) 	{ 		if((i->second.wclass == (uint32)-1) || //any weapon-			(it && ((1 << it->GetProto()->SubClass) & i->second.subclass) )+			(weapon && ((1 << weapon->GetProto()->SubClass) & i->second.subclass) ) 			)-				tmp+=i->second.value/100.0f;+				weaponModifier += i->second.value / 100.0f; 	}-	-	r = BaseDamage[0]+delta+bonus;-	r *= tmp;-	min_dmg = r * 0.9f;-	r = BaseDamage[1]+delta+bonus;-	r *= tmp;-	max_dmg = r * 1.1f; -	return float2int32(std::max((min_dmg + max_dmg)/2.0f,0.0f));++	// r = weaponModifier·(Base0 + Base1 + 2·(Delay·ap_bonus + spellEffects))/2+	int32 r = float2int32(+		weaponModifier * (BaseDamage[0] + BaseDamage[1] + 2.0f * ((float)weapon->GetProto()->Delay * ap_bonus + spellEffects)) / 2.0f );++	// right now I'm just happy windfury works at all+	// this is for someone else to fix. (Baldur)+	// sLog.outDebug("weapon mod %u not applied in GetShamanMeleeDamage. Someone might want to change this :)",+	//	GetUInt32Value( PLAYER_RATING_MODIFIER_MELEE_MAIN_HAND_SKILL ));++	return (uint32) ( r > 0 ? r : 0 ); } + void Player::EventPortToGM(Player *p) { 	SafeTeleport(p->GetMapId(),p->GetInstanceID(),p->GetPosition());Index: src/ascent-world/Player.h===================================================================--- src/ascent-world/Player.h	(revision 3613)+++ src/ascent-world/Player.h	(working copy)@@ -981,7 +981,7 @@ 		return ( s == 1 || s == 5 || s == 8 ); 	} 	void CalcDamage();-	uint32 GetMainMeleeDamage(uint32 AP_owerride); //i need this for windfury+	uint32 GetShamanMeleeDamage(uint32 AP_override, bool offHand); // for windfury      const uint64& GetSelection( ) const { return m_curSelection; } 	const uint64& GetTarget( ) const { return m_curTarget; }Index: src/ascent-world/Unit.cpp===================================================================--- src/ascent-world/Unit.cpp	(revision 3613)+++ src/ascent-world/Unit.cpp	(working copy)@@ -1173,7 +1173,8 @@ 								if( !(CastingSpell->c_is_flags & SPELL_FLAG_IS_DAMAGING)) //healing wave 									continue; 							}break;-						//shaman - windfurry weapon+						//shaman - windfury weapon+						//spell spells correct please! it took me hours to find this code 						case 8232: 						case 8235: 						case 10486:@@ -1184,12 +1185,35 @@ 									continue; 								//!! The wierd thing is that we need the spell thet trigegred this enchant spell in order to output logs ..we are using oldspell info too  								//we have to recalc the value of this spell-								SpellEntry *spellInfo = dbcSpell.LookupEntry(origId);-								uint32 AP_owerride=GetAP() + spellInfo->EffectBasePoints[0]+1;-								uint32 dmg = static_cast< Player* >( this )->GetMainMeleeDamage(AP_owerride); 								SpellEntry *sp_for_the_logs = dbcSpell.LookupEntry(spellId);-								Strike( victim, MELEE, sp_for_the_logs, dmg, 0, 0, true, false );-								Strike( victim, MELEE, sp_for_the_logs, dmg, 0, 0, true, false );++								uint32 dmg = static_cast< Player* >( this )+									->GetShamanMeleeDamage( GetAP() + ospinfo->EffectBasePoints[0] + 1, true );++++								Item* offHandWeapon = static_cast< Player* >( this )->GetItemInterface()->GetInventoryItem( EQUIPMENT_SLOT_OFFHAND );+								if( offHandWeapon != NULL+									&& offHandWeapon->GetProto() != NULL+									&& offHandWeapon->GetProto()->Class == ITEM_CLASS_WEAPON )+								{+									// off hand equipped+									// we don't know whether main or offhand triggered windfury+									// avoid exploit (slow main, fast off hand) and use lowest possible damage+									// this will make double wilding useless, unless you use same weapon, sry :-(+									// (Baldur)+									// everyone is welcome to fix this :)+									+									uint32 dmgOff = static_cast< Player* >( this )+									->GetShamanMeleeDamage( GetAP() + ospinfo->EffectBasePoints[0] + 1, false );++									if( dmgOff < dmg )+										dmg = dmgOff;+								}+++								Strike( victim, MELEE, sp_for_the_logs, 0, 0, dmg, true, true );+								Strike( victim, MELEE, sp_for_the_logs, 0, 0, dmg, true, true ); 								//nothing else to be done for this trigger 								continue; 							}break;@@ -2354,6 +2378,7 @@ 		dodge=parry=block=0.0f; 	} + 	if( IsPlayer() && static_cast< Player* >( this )->m_finishingmovesdodge && ability && ( ability->EffectPointsPerComboPoint[0] > 0 || ability->EffectPointsPerComboPoint[1] > 0 || ability->EffectPointsPerComboPoint[2] > 0 ) )  // SPELL: Surprise Attacks 		dodge = 0.0f; Index: src/ascent-world/World.cpp===================================================================--- src/ascent-world/World.cpp	(revision 3613)+++ src/ascent-world/World.cpp	(working copy)@@ -6904,21 +6904,21 @@ 	if( sp != NULL ) 		sp->procFlags = PROC_ON_CAST_SPELL; -	//windfury weapon changes. Start to hate these day by day++	// windfury weapon 	EnchantEntry* Enchantment; 		 	Enchantment = dbcEnchant.LookupEntryForced( 283 ); 	if( Enchantment != NULL ) 	{-		Enchantment->spell[0] = 33757; //this is actually good+		// Enchantment->spell[0] = 33757; //this is actually good 		sp = dbcSpell.LookupEntryForced( 33757 ); 		if( sp != NULL ) 		{-			sp->EffectApplyAuraName[0] = 42; //who needs dummys anyway ?-			sp->procFlags = PROC_ON_MELEE_ATTACK; //we do not need proc on spell ;)-			sp->EffectTriggerSpell[0] = 8232; //for the logs and rest-			sp->procChance = 20;-			sp->proc_interval = 3000;//http://www.wowwiki.com/Windfury_Weapon+			sp->EffectApplyAuraName[0] = 42;+			sp->procFlags = PROC_ON_MELEE_ATTACK; // why is ascent not using PROC_ON_PHYSICAL_ATTACK_VICTIM?+			sp->EffectTriggerSpell[0] = 8232; // fix dbc+			sp->proc_interval = 3000; // http://www.wowwiki.com/Windfury_Weapon 			sp->maxstack = 1; 		} 	}@@ -6930,11 +6930,10 @@ 		sp = dbcSpell.LookupEntryForced( 33756 ); 		if( sp != NULL ) 		{-			sp->EffectApplyAuraName[0] = 42; //who needs dummys anyway ?-			sp->procFlags = PROC_ON_MELEE_ATTACK; //we do not need proc on spell ;)-			sp->EffectTriggerSpell[0] = 8235; //for the logs and rest-			sp->procChance = 20;-			sp->proc_interval = 3000; //http://www.wowwiki.com/Windfury_Weapon+			sp->EffectApplyAuraName[0] = 42;+			sp->procFlags = PROC_ON_MELEE_ATTACK; // why is ascent not using PROC_ON_PHYSICAL_ATTACK_VICTIM?+			sp->EffectTriggerSpell[0] = 8235; // fix dbc+			sp->proc_interval = 3000; // http://www.wowwiki.com/Windfury_Weapon 			sp->maxstack = 1; 		} 	}@@ -6946,11 +6945,10 @@ 		sp = dbcSpell.LookupEntryForced( 33755 ); 		if( sp != NULL ) 		{-			sp->EffectApplyAuraName[0] = 42; //who needs dummys anyway ?-			sp->procFlags = PROC_ON_MELEE_ATTACK; //we do not need proc on spell ;)-			sp->EffectTriggerSpell[0] = 10486; //for the logs and rest-			sp->procChance = 20;-			sp->proc_interval = 3000;//http://www.wowwiki.com/Windfury_Weapon+			sp->EffectApplyAuraName[0] = 42;+			sp->procFlags = PROC_ON_MELEE_ATTACK; // why is ascent not using PROC_ON_PHYSICAL_ATTACK_VICTIM?+			sp->EffectTriggerSpell[0] = 10486; // fix dbc+			sp->proc_interval = 3000; // http://www.wowwiki.com/Windfury_Weapon 			sp->maxstack = 1; 		} 	}@@ -6962,11 +6960,10 @@ 		sp = dbcSpell.LookupEntryForced( 33754 ); 		if( sp != NULL ) 		{-			sp->EffectApplyAuraName[0] = 42; //who needs dummys anyway ?-			sp->procFlags = PROC_ON_MELEE_ATTACK; //we do not need proc on spell ;)-			sp->EffectTriggerSpell[0] = 16362; //for the logs and rest-			sp->procChance = 20;-			sp->proc_interval = 3000;//http://www.wowwiki.com/Windfury_Weapon+			sp->EffectApplyAuraName[0] = 42;+			sp->procFlags = PROC_ON_MELEE_ATTACK; // why is ascent not using PROC_ON_PHYSICAL_ATTACK_VICTIM?+			sp->EffectTriggerSpell[0] = 16362; // fix dbc+			sp->proc_interval = 3000; // http://www.wowwiki.com/Windfury_Weapon 			sp->maxstack = 1; 		} 	}@@ -6978,11 +6975,10 @@ 		sp = dbcSpell.LookupEntryForced( 33727 ); 		if( sp != NULL ) 		{-			sp->EffectApplyAuraName[0] = 42; //who needs dummys anyway ?-			sp->procFlags = PROC_ON_MELEE_ATTACK; //we do not need proc on spell ;)-			sp->EffectTriggerSpell[0] = 25505; //for the logs and rest-			sp->procChance = 20;-			sp->proc_interval = 3000;//http://www.wowwiki.com/Windfury_Weapon+			sp->EffectApplyAuraName[0] = 42;+			sp->procFlags = PROC_ON_MELEE_ATTACK; // why is ascent not using PROC_ON_PHYSICAL_ATTACK_VICTIM?+			sp->EffectTriggerSpell[0] = 25505; // fix dbc+			sp->proc_interval = 3000; // http://www.wowwiki.com/Windfury_Weapon 			sp->maxstack = 1; 		} 	}