You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so when use 'Buff to target' with option 'Buff to user when no target'
and player has no target. it cast the spell but never apply it own player.
in skill.cs i saw there was a change for this: bool foundTarget = skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out BaseCharacterEntity targetEntity) && !targetEntity.IsDead();
so when using this it works
protected void ApplySkillBuff(BaseCharacterEntity skillUser, int skillLevel, CharacterItem weapon, uint targetObjectId)
{
if (skillUser.IsDead() || !skillUser.IsServer || skillLevel <= 0)
return;
int overlapMask = GameInstance.Singleton.playerLayer.Mask | GameInstance.Singleton.playingLayer.Mask | GameInstance.Singleton.monsterLayer.Mask;
EntityInfo instigator = skillUser.GetInfo();
List<BaseCharacterEntity> tempCharacters;
BaseCharacterEntity targetEntity;
switch (skillBuffType)
{
case SkillBuffType.BuffToUser:
skillUser.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.BuffToNearbyAllies:
tempCharacters = skillUser.FindAliveEntities<BaseCharacterEntity>(buffDistance.GetAmount(skillLevel), true, false, false, overlapMask);
foreach (BaseCharacterEntity applyBuffCharacter in tempCharacters)
{
applyBuffCharacter.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
}
skillUser.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.BuffToNearbyCharacters:
tempCharacters = skillUser.FindAliveEntities<BaseCharacterEntity>(buffDistance.GetAmount(skillLevel), true, false, true, overlapMask);
foreach (BaseCharacterEntity applyBuffCharacter in tempCharacters)
{
applyBuffCharacter.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
}
skillUser.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.BuffToTarget:
targetEntity = null;
if (buffToUserIfNoTarget && !skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out targetEntity))
targetEntity = skillUser;
if (targetEntity != null && !targetEntity.IsDead())
targetEntity.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.Toggle:
int indexOfBuff = skillUser.IndexOfBuff(BuffType.SkillBuff, DataId);
if (indexOfBuff >= 0)
skillUser.Buffs.RemoveAt(indexOfBuff);
else
skillUser.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.BuffToAlly:
targetEntity = null;
if (buffToUserIfNoTarget && !skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out targetEntity))
targetEntity = skillUser;
if (targetEntity != null && !targetEntity.IsDead())
targetEntity.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
case SkillBuffType.BuffToEnemy:
targetEntity = null;
if (buffToUserIfNoTarget && !skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out targetEntity))
targetEntity = skillUser;
if (targetEntity != null && !targetEntity.IsDead())
targetEntity.ApplyBuff(DataId, BuffType.SkillBuff, skillLevel, instigator, weapon);
break;
}
}
p.S would be cool to add this change also to core:
public override bool CanUse(BaseCharacterEntity skillUser, int level, bool isLeftHand, uint targetObjectId, out UITextKeys gameMessage, bool isItem = false)
{
bool foundTarget = skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out BaseCharacterEntity targetEntity) && !targetEntity.IsDead();
switch (skillBuffType)
{
case SkillBuffType.BuffToTarget:
if (!foundTarget && !buffToUserIfNoTarget)
{
// Cannot buff enemy
gameMessage = UITextKeys.UI_ERROR_NO_SKILL_TARGET;
return false;
}
break;
case SkillBuffType.BuffToAlly:
if ((!foundTarget && !buffToUserIfNoTarget) || (foundTarget && !targetEntity.IsAlly(skillUser.GetInfo())))
{
// Cannot buff enemy
gameMessage = UITextKeys.UI_ERROR_NO_SKILL_TARGET;
return false;
}
break;
case SkillBuffType.BuffToEnemy:
if ((!foundTarget && !buffToUserIfNoTarget) || (foundTarget && !targetEntity.IsEnemy(skillUser.GetInfo())))
{
// Cannot buff enemy
gameMessage = UITextKeys.UI_ERROR_NO_SKILL_TARGET;
return false;
}
break;
}
bool canUse = base.CanUse(skillUser, level, isLeftHand, targetObjectId, out gameMessage, isItem);
if (!canUse && gameMessage == UITextKeys.UI_ERROR_NO_SKILL_TARGET && buffToUserIfNoTarget)
{
// Still allow to use skill but it's going to set applies target to skill user
gameMessage = UITextKeys.NONE;
return true;
}
return canUse;
}
so that 'Buff to user when no target' also works with 'Buff to ally' and 'Buff to enemy'
The text was updated successfully, but these errors were encountered:
in stock kit use mage -> spell Heal.
https://gyazo.com/a9d40ce956ff3416fc8124cfb190fc63
so when use 'Buff to target' with option 'Buff to user when no target'
and player has no target. it cast the spell but never apply it own player.
in skill.cs i saw there was a change for this:
bool foundTarget = skillUser.CurrentGameManager.TryGetEntityByObjectId(targetObjectId, out BaseCharacterEntity targetEntity) && !targetEntity.IsDead();
so when using this it works
p.S would be cool to add this change also to core:
so that 'Buff to user when no target' also works with 'Buff to ally' and 'Buff to enemy'
The text was updated successfully, but these errors were encountered: