protected override BattleContext CreateContext(GameEventOwner owner, Character ownerChar, BattleContext context) { Character target = (AffectTarget ? context.Target : context.User); int damage = context.GetContextStateInt <DamageDealt>(0); if (damage > 0 && ownerChar != context.User) { //the attack needs to face the foe, and *auto-target* Dir8 attackDir = DirExt.GetDir(ownerChar.CharLoc, target.CharLoc); ownerChar.CharDir = attackDir; Loc frontLoc = ownerChar.CharLoc + attackDir.GetLoc() * FrontOffset; SkillData entry = DataManager.Instance.GetSkill(InvokedMove); DungeonScene.Instance.LogMsg(String.Format(Msg.ToLocal(), ownerChar.GetDisplayName(false), context.User.GetDisplayName(false))); BattleContext newContext = new BattleContext(BattleActionType.Skill); newContext.User = ownerChar; newContext.UsageSlot = BattleContext.FORCED_SLOT; newContext.StartDir = newContext.User.CharDir; //fill effects newContext.Data = new BattleData(entry.Data); newContext.Data.ID = InvokedMove; newContext.Explosion = new ExplosionData(entry.Explosion); newContext.HitboxAction = entry.HitboxAction.Clone(); //make the attack *autotarget*; set the offset to the space between the front loc and the target newContext.HitboxAction.HitOffset = target.CharLoc - frontLoc; newContext.Strikes = entry.Strikes; newContext.Item = new InvItem(); //don't set move message, just directly give the message of what the move turned into //add a tag that will allow the moves themselves to switch to their offensive versions newContext.ContextStates.Set(new FollowUp()); return(newContext); } return(null); }