private void RightOndamage(ObjNPC npc, ObjCharacter caster, int damage) { mIsFubenInfoDirty = true; var unit = mFubenInfoMsg.Units[1]; unit.Params[2] = npc.GetAttribute(eAttributeType.HpNow) * 100 / npc.GetAttribute(eAttributeType.HpMax); }
protected ObjCharacter ScanEnemy(ObjNPC npc, float distance) { if (null == npc) { return(null); } if (null == npc.Zone) { return(null); } var sq = distance * distance; ObjCharacter target = null; var objs = npc.Zone.EnumAllVisibleObj(); foreach (var obj in objs) { if (null == obj) { continue; } if (obj.ObjId == npc.ObjId) { continue; } if (!obj.IsCharacter()) { continue; } var character = obj as ObjCharacter; if (null == character) { continue; } if (character.IsDead()) { continue; } if (!npc.IsMyEnemy(character)) { continue; } var temp = (npc.GetPosition() - character.GetPosition()).LengthSquared(); if (temp <= sq) { target = character; sq = temp; } } return(target); }
public void LevelScene(SceneManager _this, ObjCharacter obj) { if (obj == null) { return; } var scene = obj.Scene; if (scene == null) { Logger.Info("GetSceneObj null..............."); return; } //后台统计 try { string v = string.Format("scene#{0}|{1}|{2}|{3}|{4}|{5}|{6}", obj.ServerId, obj.ObjId, obj.GetLevel(), obj.Attr.GetFightPoint(), //战力 obj.Scene.TypeId, 1, //0:进入 1:离开 DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); // 时间 PlayerLog.Kafka(v); } catch (Exception) { } scene.LeaveScene(obj); }
private void Add(TriggerArea _this, ObjCharacter character) { if (null == character) { return; } if (!_this.mCharacterList.Contains(character)) { _this.mCharacterList.Add(character); try { _this.Scene.OnCharacterEnterArea(_this.Id, character); } catch (Exception e) { Logger.Error(e, "Scene.OnCharacterEnterArea"); } } else { Logger.Warn("TriggerArea mObjDict has this"); } if (character.GetObjType() == ObjType.PLAYER) { if (!_this.mPlayer.Contains(character)) { _this.mPlayer.Add(character as ObjPlayer); } } }
//修改Buff表格数据 public void ModifyBuffTableData(ObjCharacter casterHero, BuffData buff, int buffId, int buffLevel) { buff.m_nLevel = buffLevel; var tbbuff = Table.GetBuff(buffId); buff.mBuff = casterHero.Skill.ModifyBuff(tbbuff, buffLevel); }
private ObjCharacter GetCanAttack(ObjNPC npc) { if (mLastEnemy == null || mLastEnemy.IsDead() || !mLastEnemy.Active) { ObjCharacter temp = null; var maxDis = 9999999.0f; foreach (var pair in npc.Scene.mObjDict) { var t = pair.Value as ObjCharacter; if (t == null) { continue; } if (t.IsDead() || !t.Active) { continue; } if (!mAddList.Contains(t.TypeId)) { continue; } var dis = (npc.GetPosition() - t.GetPosition()).LengthSquared(); if (dis < maxDis) { temp = t; maxDis = dis; } } return(temp); } return(mLastEnemy); }
//查询相同释放者的互斥ID public BuffData Get_Same_Caster_Huchi_Buff(BuffList _this, int huchiid, ObjCharacter sameCaster = null) { if (sameCaster == null) { foreach (var buff in _this.mData) { if (buff.GetActive() == false) { continue; } if (buff.m_nHuchi == huchiid) { return(buff); } } return(null); } foreach (var buff in _this.mData) { if (buff.GetActive() == false) { continue; } if (buff.m_nHuchi == huchiid && buff.mCasterId == sameCaster.ObjId) { return(buff); } } return(null); }
private void OnDamage50016(ObjNPC npc, ObjCharacter caster, int damage) { if (BattleObjIdList.Contains(mNpc50017.ObjId)) { BroadcastScene(player => { player.Proxy.NotifyBattleReminder(14, Utils.WrapDictionaryId(100001505), 1); }); } }
//创建子弹(靠目标) public TargetBullet CreateBullet(ObjCharacter caster, int BulletId, int nLevel, eSkillHitType hitType, ObjCharacter target) { var tbbullet = Table.GetBullet(BulletId); if (tbbullet == null) { return(null); } if (target == null) { return(null); } if (tbbullet.AttackMonsterID[0] != -1) { foreach (var i in tbbullet.AttackMonsterID) { if (target.TypeId == i) { return(new TargetBullet(caster, tbbullet, nLevel, hitType, target)); } } return(null); } return(new TargetBullet(caster, tbbullet, nLevel, hitType, target)); }
//增加buff public BuffData AddBuff(BuffList _this, int buffId, int bufflevel, ObjCharacter caster, ObjCharacter bear, float fBili, eHitType hitType) { #if DEBUG if (caster is ObjPlayer) { Logger.Info("id={0}给{1}释放了{2}的Buff", caster.ObjId, bear.ObjId, buffId); } #endif var tbbuff = Table.GetBuff(buffId); var buff = ObjectPool <BuffData> .NewObject(); //var buff = ObjectPool<BuffData>.NewObject(); buff.mBuff = caster.Skill.ModifyBuff(tbbuff, bufflevel); buff.Reset(GetNextUniqueId(_this), buffId, bufflevel, caster, buff.mBuff, bear, hitType, fBili); //mBuff = tbbuff, buff.Init(); _this.mData.Add(buff); _this.mObj.MarkDbDirty(); return(buff); }
// 设置无敌 private void SetInvincible(ObjCharacter obj) { if (obj != null) { obj.AddBuff(1501, 1, obj); } }
public ObjRetinue CreateRetinue(Scene _this, int dataId, ObjCharacter owner, Vector2 pos, Vector2 dir, int camp, int level = -1) { if (Table.GetNpcBase(dataId) == null) { Logger.Error("CreateRetinue retinue = {0},objId={1}", dataId, owner.ObjId); return(null); } var npc = new ObjRetinue(); npc.Init(_this.GenerateNextId(), dataId, owner); npc.SetPosition(pos.X, pos.Y); npc.SetDirection(dir); if (level > 0) { npc.SetLevel(level); npc.InitData(level); } else { npc.InitData(level); } npc.SetCamp(camp); _this.EnterScene(npc); return(npc); }
// 取消无敌 private void CancelInvincible(ObjCharacter obj) { if (obj != null) { obj.DeleteBuff(1501, eCleanBuffType.Clear); } }
//广播移动 public void BroadcastMoveTo(ObjCharacter _this) { if (!_this.mActive) { return; } if (null == _this.Zone) { return; } var msg = new CharacterMoveMsg { ObjId = _this.ObjId }; foreach (var pos in _this.mTargetPos) { msg.TargetPos.Add(new Vector2Int32 { x = Utility.MultiplyPrecision(pos.X), y = Utility.MultiplyPrecision(pos.Y) }); } if (ObjCharacter.BroadcastMoveToType == 1) { _this.Zone.PushMoveToMsg(msg); return; } SceneServer.Instance.ServerControl.SyncMoveTo(_this.EnumAllVisiblePlayerIdExclude(_this.ObjId), msg); }
//子弹广播 public void BroadcastShootBullet(ObjCharacter _this, int bulletId, ulong casterId, ulong targetId, int delayView) { if (!_this.mActive) { return; } if (null == _this.Zone) { return; } var msg = new BulletMsg { BulletId = bulletId, CasterId = casterId }; if (delayView > 0) { msg.ViewTime = Extension.AddTimeDiffToNet(delayView); } msg.TargetObjId.Add(targetId); if (ObjCharacter.BroadcastType == 1) { _this.Zone.PushBulletMsg(msg); return; } SceneServer.Instance.ServerControl.NotifyShootBullet(_this.EnumAllVisiblePlayerIdExclude(), msg); }
//广播自己位置 public void BroadcastSelfPostion(ObjCharacter _this) { if (!_this.mActive) { return; } if (null == _this.Zone) { return; } var msg = new SyncPostionMsg(); msg.ObjId = _this.ObjId; msg.Pos = new PositionData { Pos = new Vector2Int32 { x = Utility.MultiplyPrecision(_this.GetPosition().X), y = Utility.MultiplyPrecision(_this.GetPosition().Y) }, Dir = new Vector2Int32 { x = Utility.MultiplyPrecision(_this.GetDirection().X), y = Utility.MultiplyPrecision(_this.GetDirection().Y) } }; SceneServer.Instance.ServerControl.SyncStopMove(_this.EnumAllVisiblePlayerIdExclude(), msg); }
public void Reset(BuffData _this, uint id, int dataid, int bufflevel, ObjCharacter caster, BuffRecord tbbuff, ObjCharacter bear, eHitType hitType, float fBili) { _this.mId = id; _this.m_nBuffId = dataid; _this.m_nLevel = bufflevel; SetCaster(_this, caster); _this.m_fDuration = (float)tbbuff.Duration / 1000; _this.m_Bear = bear; _this.m_nLayer = 1; _this.m_nHuchi = tbbuff.HuchiId; _this.m_HitType = hitType; _this.m_fModify = fBili; _this.m_bActive = true; _this.m_nUpdataCount = 0; _this.m_Flag.CleanFlag(0); _this.mCoolDownTime = DateTime.MinValue; _this.RemainAbsorbDict.Clear(); for (var i = 0; i < tbbuff.effectid.Length; ++i) { var effectId = tbbuff.effectid[i]; var absorbMax = tbbuff.effectparam[i, 2]; if (effectId == (int)eEffectType.AbsorbInjury && absorbMax > 0) { _this.RemainAbsorbDict[(byte)i] = absorbMax; } } }
//创建子弹(靠目标) public static TargetBullet CreateBullet(ObjCharacter caster, int BulletId, int nLevel, eSkillHitType hitType, ObjCharacter target) { return(mImpl.CreateBullet(caster, BulletId, nLevel, hitType, target)); }
/// <summary> /// 输出成一个objdata用于客户端创建 /// </summary> /// <returns></returns> public ObjData DumpObjData(ObjRetinue _this, ReasonType reason) { var data = ObjCharacter.GetImpl().DumpObjData(_this, reason); data.Owner = new Uint64Array(); data.Owner.Items.Add(_this.Owner.ObjId); return(data); }
//创建子弹(靠方向) public static DirectionBullet CreateBullet(ObjCharacter caster, int BulletId, int nLevel, eSkillHitType hitType, Vector2 direction) { return(mImpl.CreateBullet(caster, BulletId, nLevel, hitType, direction)); }
public DirectionBullet(ObjCharacter caster, BulletRecord tbbullet, int nLevel, eSkillHitType hitType, Vector2 direction) { mImpl.InitDirectionBullet(this, caster, tbbullet, nLevel, hitType, direction); }
//女神受到伤害 private void OnHolderDamage(ObjNPC npc, ObjCharacter caster, int damage) { mDataDirty = true; var hpPercent = (int)(100.0 * npc.GetAttribute(eAttributeType.HpNow) / npc.GetAttribute(eAttributeType.HpMax)); mInfo3.Params[0] = hpPercent; }
public TargetBullet(ObjCharacter caster, BulletRecord tbbullet, int nLevel, eSkillHitType hitType, ObjCharacter target) { mImpl.InitTargetBullet(this, caster, tbbullet, nLevel, hitType, target); }
public override void OnCharacterLeaveArea(int areaId, ObjCharacter character) { if (character.GetObjType() != ObjType.PLAYER) { return; } OnTriggerAreaPlayersChanged(AreaDict[areaId]); }
public ObjRetinue CreateRetinue(int dataId, ObjCharacter owner, Vector2 pos, Vector2 dir, int camp, int level = -1) { return(mImpl.CreateRetinue(this, dataId, owner, pos, dir, camp, level)); }
public static void DoEffect(Scene scene, ObjCharacter target, ObjCharacter caster) { var tempList = target.BuffList.CopyBuff(); foreach (var buff in tempList) { BuffEvent.DoBuff(scene, target, buff, 0, m_sType); } }
//调玩家位置 public static IEnumerator GmGoto(Coroutine coroutine, ObjCharacter Character, int targetSceneId, int x, int y, AsyncReturnValue <ErrorCodes> error) { return(mImpl.GmGoto(coroutine, Character, targetSceneId, x, y, error)); }
//增加buff public BuffData AddBuff(int buffId, int bufflevel, ObjCharacter caster, ObjCharacter bear, float fBili, eHitType hitType) { return(mImpl.AddBuff(this, buffId, bufflevel, caster, bear, fBili, hitType)); }
//删除Buff public void DelBuff(ObjCharacter character, int buffId) { var buffs = character.BuffList.GetBuffById(buffId); foreach (var buff in buffs) { MissBuff.DoEffect(character.Scene, character, buff); character.DeleteBuff(buff, eCleanBuffType.Clear); } }
public void Reset(uint id, int dataid, int bufflevel, ObjCharacter caster, BuffRecord tbbuff, ObjCharacter bear, eHitType hitType, float fBili) { mImpl.Reset(this, id, dataid, bufflevel, caster, tbbuff, bear, hitType, fBili); }