public void AttackTo(AttackInfo attackInfo) { Vector3 target = attackInfo.Target; target.y = transform.position.y; transform.LookAt(target); Attack(attackInfo.AttackType); }
public void Damaged(Actor self, AttackInfo e) { var eva = self.World.WorldActor.Info.Traits.Get<EvaAlertsInfo>(); if (e.DamageState == DamageState.Dead) Sound.PlayToPlayer(self.Owner, self.Info.Traits.Get<OwnedActorInfo>().WaterBound ? eva.NavalUnitLost : eva.UnitLost); }
public Attack(ServerPacket pck) : base(pck) { this.AttackerObjectID = ReadInt(); this.TargetObjectID = ReadInt(); this.Flags = ReadByte(); this.Damage = ReadInt(); this.Position += 8; this.X = ReadInt(); this.Y = ReadInt(); this.Z = ReadInt(); short count = ReadShort(); this.Hits = new List<AttackInfo>(count); for (int i = 0; i < count; i++) { var atkInfo = new AttackInfo(); atkInfo.TargetID = ReadInt(); atkInfo.Damage = ReadInt(); this.Position += 8; this.Hits.Add(atkInfo); } this.TargetX = ReadInt(); this.TargetY = ReadInt(); this.TargetZ = ReadInt(); }
// 공격 정보를 가져온다. AttackInfo GetAttackInfo() { AttackInfo attackInfo = new AttackInfo(); // 공격력 계산. attackInfo.attackPower = status.Power; attackInfo.attacker = transform.root; return attackInfo; }
// 공격 정보를 가져온다. AttackInfo GetAttackInfo() { AttackInfo attackInfo = new AttackInfo(); // 공격력 계산. attackInfo.attackPower = status.Power; if (status.attackPowerBoost) attackInfo.attackPower += attackInfo.attackPower / 2; attackInfo.attacker = transform.root; return attackInfo; }
AttackInfo GetAttackInfo() { AttackInfo attackInfo = new AttackInfo(); // Calcuate attack point. attackInfo.attackPower = status.Pow; if (status.powerBoost) { attackInfo.attackPower += attackInfo.attackPower; } attackInfo.attacker = transform.root; return attackInfo; }
// 攻撃情報を取得する. AttackInfo GetAttackInfo() { AttackInfo attackInfo = new AttackInfo(); // 攻撃力の計算. attackInfo.attackPower = status.Power; // 攻撃強化中 if (status.powerBoost) attackInfo.attackPower += 7; attackInfo.attacker = transform.root; return attackInfo; }
private void CheckAttackInput() { if (Input.GetButtonDown("WeakAttack")) SendMessage("Attack", AttackType.WeakAttack); else if (Input.GetButtonDown("MouseWeakAttack")) { AttackInfo attackInfo = new AttackInfo(AttackType.WeakAttack, getMouseTarget()); SendMessage("AttackTo", attackInfo); } else if (Input.GetButtonDown("StrongAttack")) SendMessage("Attack", AttackType.StrongAttack); else if (Input.GetButtonDown("MouseStrongAttack")) { AttackInfo attackInfo = new AttackInfo(AttackType.StrongAttack, getMouseTarget()); SendMessage("AttackTo", attackInfo); } }
public override void Damaged(Actor self, AttackInfo e) { if (!e.DamageStateChanged) return; switch (e.DamageState) { case DamageState.Normal: anim.Play( "idle" ); break; case DamageState.Half: anim.Play( "damaged-idle" ); Sound.Play(self.Info.Traits.Get<BuildingInfo>().DamagedSound); break; } }
public virtual void ApplyDamage(AttackInfo attackInfo) { //attackInfo.DamageAmount -= ArmorDamageAbsorb; if (IsDead || attackInfo.DamageAmount <= 0) { return; } DamageTaken += attackInfo.DamageAmount; //broadcast hit EventsAggregator.Units.Broadcast<BaseUnit, HitInfo>(EUnitEvent.HitReceived, this, new HitInfo(HealthPoints - DamageTaken + attackInfo.DamageAmount, HealthPoints - DamageTaken));//, attackInfo.IsCritical)); if (IsDead) { //broadcast death EventsAggregator.Units.Broadcast<BaseUnit>(EUnitEvent.DeathCame, this); } }
// -------- Public Functions -------- public void TakeDamage(AttackInfo atk) { HitInfo hitInfo = new HitInfo(); // Create new hitInfo to pass back to attacker float appliedDmg = atk.damage; // Figure out weaknesses if (weakAgainst.Contains(atk.type)) { appliedDmg *= weaknessMultiplier; hitInfo.weaknessDmg = appliedDmg - atk.damage; } // Figre out Resitances else if (resistantTo.Contains(atk.type)) { appliedDmg *= resistanceMultiplier; hitInfo.weaknessDmg = atk.damage - appliedDmg; } // Set total DMG hitInfo.totalDmgDealt = appliedDmg; // Apply damage currentHP -= appliedDmg; // Let others know -- display stuff and whatnot UpdateBar (); playHitSound (atk.type); atk.hitCallback (hitInfo); ShowFloatingText (appliedDmg); StartCoroutine ("FlashOnHit"); // Check Death if (currentHP <= 0) { // Set vars, call onHit of attacker currentHP = 0; hitInfo.killed = true; atk.killCallback (hitInfo); // End our misery Die (); } }
void INotifyDamage.Damaged(Actor self, AttackInfo e) { power.UpdateActor(self); }
public override AttackInfo Defend(CreepUnit Target) { double AtkAmp = 1; double CritAmp = 1; double Attack; bool isCritical = false; int AtkPower = Strength + (Level * 1); if (Target.Weakness == DmgType) { AtkAmp += 0.25; } if (Target.Resist == DmgType) { AtkAmp -= 0.25; } Random Rand = new Random(); int Crit = Rand.Next(30 + (Level * 2) + Luck); if (Crit < Luck) { isCritical = true; CritAmp += Rand.NextDouble(); if (CritAmp > 1.4) { CritAmp = 1.4; } else if (CritAmp < 1.25) { CritAmp = 1.25; } } AtkPower += (AtkPower / 2) + Rand.Next(AtkPower / 2); Attack = (double)AtkPower * AtkAmp * CritAmp; Target.Health -= (int)Attack; AttackInfo info = new AttackInfo((int)Attack, DmgType, isCritical, Class); info.X = Target.Position.X; info.Y = Target.Position.Y; return info; }
protected override async Task Handle(GameStageUser stageUser, IFieldObjUser user, IPacketReader packet) { var clientAttackInfo = packet.Read(new ClientAttackInfo()); var skill = (Skill)clientAttackInfo.SkillID; var skillLevel = clientAttackInfo.SkillID > 0 ? user.Character.GetSkillLevel(clientAttackInfo.SkillID) : 0; var damageType = Type == AttackType.Magic ? DamageType.Magic : DamageType.Physical; var damageApply = new List <Tuple <IFieldObjMob, int> >(); if (Type == AttackType.Melee) { // TODO bmage blows } if (Type == AttackType.Body) { // TODO teleport mastery } var operation = (PacketSendOperations)((int)PacketSendOperations.UserMeleeAttack + (int)Type); var response = new UnstructuredOutgoingPacket(operation); response.WriteInt(user.ID); response.WriteByte((byte)(clientAttackInfo.DamagePerMob | 16 * clientAttackInfo.MobCount)); response.WriteByte(user.Character.Level); response.WriteByte((byte)skillLevel); if (skillLevel > 0) { response.WriteInt(clientAttackInfo.SkillID); } response.WriteByte((byte)( 1 * Convert.ToByte(clientAttackInfo.IsFinalAfterSlashBlast) | 8 * Convert.ToByte(clientAttackInfo.IsShadowPartner) | 16 * 0 | 32 * Convert.ToByte(clientAttackInfo.IsSerialAttack) )); response.WriteShort((short)( clientAttackInfo.Action & 0x7FFF | Convert.ToByte(clientAttackInfo.IsFacingLeft) << 15) ); if (clientAttackInfo.Action <= 0x110) { response.WriteByte(0); // nMastery response.WriteByte(0); // v82 response.WriteInt(0); // bMovingShoot clientAttackInfo.Mobs.ForEach(m => { var critical = new bool[clientAttackInfo.DamagePerMob]; var damage = new int[clientAttackInfo.DamagePerMob]; var totalDamage = m.Damage.Sum(); var mob = user.Field.GetObject <IFieldObjMob>(m.MobID); response.WriteInt(m.MobID); response.WriteByte(m.HitAction); if (mob != null) { var equipInventory = user.Character.Inventories[ItemInventoryType.Equip]; var serverAttackInfo = new AttackInfo(user, mob) { WeaponID = equipInventory.Items.ContainsKey((short)BodyPart.Weapon) ? equipInventory.Items[(short)BodyPart.Weapon].TemplateID : 0, BulletID = 0, SkillID = clientAttackInfo.SkillID, SkillLevel = skillLevel }; var calculatedDamage = damageType == DamageType.Physical ? user.Damage.CalculateCharacterPDamage(serverAttackInfo) : user.Damage.CalculateCharacterMDamage(serverAttackInfo); var calculatedTotalDamage = calculatedDamage.Select(d => d.Damage).Sum(); // TODO cheatdetector? if (clientAttackInfo.DamagePerMob != calculatedDamage.Length) { user.Message($"Attack count mismatch: {clientAttackInfo.DamagePerMob} : {calculatedDamage.Length}"); return; } if (totalDamage != calculatedTotalDamage) { user.Message($"Client damage: {string.Join(" + ", m.Damage.Select(m => $"{m}"))} = {totalDamage}"); user.Message($"Server damage: {string.Join(" + ", calculatedDamage.Select(m => $"{m.Damage}"))} = {calculatedTotalDamage}"); } damageApply.Add(Tuple.Create(mob, calculatedTotalDamage)); for (var i = 0; i < clientAttackInfo.DamagePerMob; i++) { critical[i] = calculatedDamage[i].IsCritical; damage[i] = calculatedDamage[i].Damage; } } else { user.Damage.SkipCalculationForCharacterDamage(); } for (var i = 0; i < clientAttackInfo.DamagePerMob; i++) { response.WriteBool(critical[i]); response.WriteInt(damage[i]); } }); } // TODO Keydown await user.FieldSplit.Dispatch(user, response); await Task.WhenAll(damageApply.Select(async a => { var(mob, damage) = a; mob.Controller = user; await mob.Damage(user, damage); })); }
public void DamageStateChanged(Actor self, AttackInfo e) { left.ReplaceAnim(NormalizeSequence(left, e.DamageState, left.CurrentSequence.Name)); right.ReplaceAnim(NormalizeSequence(right, e.DamageState, right.CurrentSequence.Name)); }
// 가위바위보 결과와 공격/방어에서 승패를 구합니다. public static Winner GetActionWinner(AttackInfo server, AttackInfo client, Winner rpsWinner) { string debugStr = "rpsWinner:" + rpsWinner.ToString(); debugStr += " server.actionKind:" + server.actionKind.ToString() + " time:" + server.actionTime.ToString(); debugStr += " client.actionKind:" + client.actionKind.ToString() + " time:" + client.actionTime.ToString(); Debug.Log(debugStr); ActionKind serverAction = server.actionKind; ActionKind clientAction = client.actionKind; // 공격/방어가 바르게 이루어졌는지 판정합니다. switch (rpsWinner) { case Winner.ServerPlayer: if (serverAction != ActionKind.Attack) { // 1P가 공격을 하지 않았으므로 무승부. return Winner.Draw; } else if (clientAction != ActionKind.Block) { // 2P가 틀렸으므로 1P 승리. return Winner.ServerPlayer; } // 決着は시간이 됩니다. break; case Winner.ClientPlayer: if (clientAction != ActionKind.Attack) { // 2P가 공격을 하지 않았으므로 무승부.. return Winner.Draw; } else if (serverAction != ActionKind.Block) { // 1P가 틀렸으므로 2P가 승리합니다. return Winner.ClientPlayer; } // 決着は시간이 됩니다. break; case Winner.Draw: //무승부일 때는 무엇을 해도 무승부입니다. return Winner.Draw; } // 시간 대결. float serverTime = server.actionTime; float clientTime = client.actionTime; if (serverAction == ActionKind.Attack) { // 1P가 공격인 경우는 2P보다 빠를 때 이기게 됩니다. if (serverTime < clientTime) { // 1P 쪽이 빠르므로 승리입니다. return Winner.ServerPlayer; } } else { // 2P가 공격인 경우는 2P보다도 빠르게 방어하지 않으면 패배입니다. if (serverTime > clientTime) { return Winner.ClientPlayer; } } // 같은 시간이므로 무승부입니다. return Winner.Draw; }
public void CheckAttack(uint attackerID, Position attackerPos, float attackerScale, AttackCone attackCone, AttackInfo attackInfo) { foreach (var shadowObj in ShadowObjectList) { var pObj = shadowObj.PhysicsObj; if (pObj.ID == attackerID || pObj.State.HasFlag(PhysicsState.Static)) { continue; } var hitLocation = pObj.check_attack(attackerPos, attackerScale, attackCone, attackInfo.AttackRadius); if (hitLocation != 0) { attackInfo.AddObject(pObj.ID, hitLocation); } } }
public override void DamageStateChanged(Actor self, AttackInfo e) { base.DamageStateChanged(self, e); turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings; }
void INotifyDamage.Damaged(Actor self, AttackInfo e) { if (IsTraitDisabled || !self.IsIdle || Stance < UnitStance.ReturnFire) { return; } // Don't retaliate against healers if (e.Damage.Value < 0) { return; } var attacker = e.Attacker; if (attacker.Disposed) { return; } foreach (var dat in disableAutoTarget) { if (dat.DisableAutoTarget(self)) { return; } } if (!attacker.IsInWorld) { // If the aggressor is in a transport, then attack the transport instead var passenger = attacker.TraitOrDefault <Passenger>(); if (passenger != null && passenger.Transport != null) { attacker = passenger.Transport; } } // Don't fire at an invisible enemy when we can't move to reveal it var allowMove = allowMovement && Stance > UnitStance.Defend; if (!allowMove && !attacker.CanBeViewedByPlayer(self.Owner)) { return; } // Not a lot we can do about things we can't hurt... although maybe we should automatically run away? var attackerAsTarget = Target.FromActor(attacker); if (!ActiveAttackBases.Any(a => a.HasAnyValidWeapons(attackerAsTarget))) { return; } // Don't retaliate against own units force-firing on us. It's usually not what the player wanted. if (attacker.AppearsFriendlyTo(self)) { return; } Aggressor = attacker; Attack(self, Target.FromActor(Aggressor), allowMove); }
public void Killed(Actor self, AttackInfo e) { if (!self.IsInWorld) { return; } self.World.AddFrameEndTask(w => { var td = new TypeDictionary { new ParentActorInit(self), new LocationInit(self.Location), new CenterPositionInit(self.CenterPosition), new OwnerInit(self.Owner), new SkipMakeAnimsInit() }; // Allows the husk to drag to its final position var mobile = self.TraitOrDefault <Mobile>(); if (mobile != null) { if (!mobile.CanEnterCell(self.Location, self, false)) { return; } td.Add(new HuskSpeedInit(mobile.MovementSpeedForCell(self, self.Location))); } var aircraft = self.TraitOrDefault <Aircraft>(); if (aircraft != null) { td.Add(new AltitudeInit(aircraft.CenterPosition.Z * Game.CellSize / 1024)); } var facing = self.TraitOrDefault <IFacing>(); if (facing != null) { td.Add(new FacingInit(facing.Facing)); } // TODO: This will only take the first turret if there are multiple // This isn't a problem with the current units, but may be a problem for mods var turreted = self.TraitsImplementing <Turreted>().FirstOrDefault(); if (turreted != null) { td.Add(new TurretFacingInit(turreted.turretFacing)); } var chronoshiftable = self.TraitOrDefault <Chronoshiftable>(); if (chronoshiftable != null && chronoshiftable.ReturnTicks > 0) { td.Add(new ChronoshiftOriginInit(chronoshiftable.Origin)); td.Add(new ChronoshiftReturnInit(chronoshiftable.ReturnTicks)); } var huskActor = self.TraitsImplementing <IHuskModifier>() .Select(ihm => ihm.HuskActor(self)) .FirstOrDefault(a => a != null); w.CreateActor(huskActor ?? info.HuskActor, td); }); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { if (IsTraitDisabled || self.Owner.WinState == WinState.Lost || !self.World.Map.Contains(self.Location)) { return; } if (self.World.SharedRandom.Next(100) >= Info.SuccessRate) { return; } var cp = self.CenterPosition; var inAir = !self.IsAtGroundLevel(); if ((inAir && !Info.EjectInAir) || (!inAir && !Info.EjectOnGround)) { return; } self.World.AddFrameEndTask(w => { if (!Info.AllowUnsuitableCell) { var pilotInfo = self.World.Map.Rules.Actors[Info.PilotActor.ToLowerInvariant()]; var pilotPositionable = pilotInfo.TraitInfo <IPositionableInfo>(); if (!pilotPositionable.CanEnterCell(self.World, null, self.Location)) { return; } } var td = new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location), }; // If airborne, offset the spawn location so the pilot doesn't drop on another infantry's head var spawnPos = cp; if (inAir) { var subCell = self.World.ActorMap.FreeSubCell(self.Location); if (subCell != SubCell.Invalid) { td.Add(new SubCellInit(subCell)); spawnPos = self.World.Map.CenterOfSubCell(self.Location, subCell) + new WVec(0, 0, spawnPos.Z); } } td.Add(new CenterPositionInit(spawnPos)); var pilot = self.World.CreateActor(true, Info.PilotActor.ToLowerInvariant(), td); if (!inAir) { pilot.TraitOrDefault <Mobile>()?.Nudge(pilot); } else { Game.Sound.Play(SoundType.World, Info.ChuteSound, cp); } }); }
protected override void Awake() { base.Awake(); // (Need a modification) // 이 데이터를 스크립트에 넣으면 각 해당하는 스킬 마다 // 초기화하는 작업 해야겠어용 //startDelayTime = 3.0f; endDelayTime = 0.5f; coolTime = 0.0f; attackInfoList = new AttackInfo[continuousAttackNum]; AttackBoxInfo attackBoxInfo = new AttackBoxInfo(); attackBoxInfo.offset = new Vector3(0.0f, 1.0f, 1.0f); attackBoxInfo.size = new Vector3(1.0f, 1.0f, 1.0f); attackBoxInfo.aliveTime = 1.0f; AttackInfo attackInfo = new AttackInfo(); attackInfo.inputDelayTime = 0.0f; attackInfo.nextSkillTimeOrInputWaitingTime = 0.0f; attackInfo.needInput = KeyCode.None; attackInfo.attackBox = attackBoxInfo; attackInfo.commonEffectIndex = 0; attackInfo.effectOffset = new Vector3(0.0f, 1.0f, 1.0f); attackInfo.ownerAnimationName = "ML_0"; attackInfo.needInput = KeyCode.None; attackInfoList[0] = attackInfo; attackInfo.inputDelayTime = 0.1f; attackInfo.nextSkillTimeOrInputWaitingTime = 0.9f; attackInfo.needInput = KeyCode.Mouse0; attackInfo.ownerAnimationName = "ML_1"; attackInfoList[1] = attackInfo; attackInfo.inputDelayTime = 0.1f; attackInfo.nextSkillTimeOrInputWaitingTime = 0.9f; attackInfo.needInput = KeyCode.Mouse0; attackInfo.ownerAnimationName = "ML_2"; attackInfoList[2] = attackInfo; // (Need a modification) // AdditionMovement Test isMovable = true; AdditionMovement additionMovementInfo_none; additionMovementInfo_none.needInput = KeyCode.None; additionMovementInfo_none.duringTime = 0.2f; additionMovementInfo_none.additionMovement = new Vector3(0.0f, 0.0f, 0.5f); AdditionMovement additionMovementInfo_w; additionMovementInfo_w.needInput = KeyCode.W; additionMovementInfo_w.duringTime = 0.2f; additionMovementInfo_w.additionMovement = new Vector3(0.0f, 0.0f, 1.0f); AdditionMovement additionMovementInfo_s; additionMovementInfo_s.needInput = KeyCode.S; additionMovementInfo_s.duringTime = 0.2f; additionMovementInfo_s.additionMovement = new Vector3(0.0f, 0.0f, 0.0f); attackInfoList[0].additionMovementList = new AdditionMovement[3]; attackInfoList[0].additionMovementList[0] = additionMovementInfo_none; attackInfoList[0].additionMovementList[1] = additionMovementInfo_w; attackInfoList[0].additionMovementList[2] = additionMovementInfo_s; attackInfoList[1].additionMovementList = new AdditionMovement[3]; attackInfoList[1].additionMovementList[0] = additionMovementInfo_none; attackInfoList[1].additionMovementList[1] = additionMovementInfo_w; attackInfoList[1].additionMovementList[2] = additionMovementInfo_s; attackInfoList[2].additionMovementList = new AdditionMovement[3]; attackInfoList[2].additionMovementList[0] = additionMovementInfo_none; attackInfoList[2].additionMovementList[1] = additionMovementInfo_w; attackInfoList[2].additionMovementList[2] = additionMovementInfo_s; }
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) { DamageStateChanged(self); }
public static void show(GameObject popupDamage, Vector2 attackerPosition, Vector2 defenderPosition, AttackInfo attackInfo) { GameObject damageObject = Instantiate(popupDamage, defenderPosition, Quaternion.identity); damageObject.GetComponent <DamagePopup>().value = attackInfo.damage; GUIStyle damageGuiStyle = new GUIStyle(); damageGuiStyle.fontSize = 18; damageGuiStyle.normal.textColor = Color.red; if (attackInfo.critical) { damageGuiStyle.fontSize = 36; damageGuiStyle.fontStyle = FontStyle.Bold; } damageObject.GetComponent <DamagePopup>().guiStyle = damageGuiStyle; GameObject recoveryObject = Instantiate(popupDamage, attackerPosition, Quaternion.identity); recoveryObject.GetComponent <DamagePopup>().value = attackInfo.recovery; GUIStyle recoveryGuiStyle = new GUIStyle(); recoveryGuiStyle.fontSize = 24; recoveryGuiStyle.normal.textColor = Color.green; recoveryObject.GetComponent <DamagePopup>().guiStyle = recoveryGuiStyle; }
public override void DamageStateChanged(Actor self, AttackInfo e) { DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent); }
// Fire primary on death public void Killed(Actor self, AttackInfo e) { Detonate(self, e.Attacker); }
public double[] GetCurrentSkillDamge(int skillId, int level) { double[] defaultDouble = new double[] { 0, 0 }; WeaponAttribute attr = ConfigManager.Get <WeaponAttribute>(moduleEquip.weapon.itemTypeId); if (!attr) { return(defaultDouble); } SkillToStateInfo states = m_currentSkillStates.Find(p => p.skillId == skillId && (p.elmentType == attr.elementType || p.elmentType == 0)); if (!states || states.stateNames == null || states.stateNames.Length < 1) { return(defaultDouble); } double damage = 0; double spcail = 0; int weapon = moduleEquip.weapon.GetPropItem().subType; for (int i = 0; i < states.stateNames.Length; i++) { int stateID = CreatureStateInfo.NameToID(states.stateNames[i]); var _state = StateOverrideInfo.GetOverrideState(weapon, stateID, level); //int reliveID = CreatureStateInfo.NameToID(ReLiveState); //if (reliveID == stateID) //{ // reliveSkillId = states.skillId; // if (_state.buffs.Length > 0) // { // defaultDouble[0] = (double)_state.buffs[0].duration / 1000; // return defaultDouble; // } //} for (int j = 0; j < _state.sections.Length; j++) { if (_state.sections[j].attackBox.isEmpty) { continue; } var attack = AttackInfo.Get(_state.sections[j].attackBox.attackInfo); if (attack == null || attack.isIgnoreDamge) { continue; } if (attack.execution) { spcail += attack.damage; continue; } damage += attack.damage; } int fly = _state.flyingEffects.Length; if (fly > 0) { for (int k = 0; k < fly; k++) { var effect = ConfigManager.Get <FlyingEffectInfo>(_state.flyingEffects[k].effect); if (effect == null) { continue; } //统计hiteffect的伤害,必须满足subeffect中不包含相同的effectid if (!effect.hitEffect.isEmpty) { StateMachineInfo.FlyingEffect exist = StateMachineInfo.FlyingEffect.empty; if (effect.subEffects != null && effect.subEffects.Length > 0) { exist = effect.subEffects.Find(p => p.effect == effect.hitEffect.effect); } if (exist.isEmpty) { double[] hit = HitEffectDamage(effect.hitEffect); damage += hit[0]; spcail += hit[1]; } } if (effect.subEffects != null && effect.subEffects.Length > 0) { double[] sub = SubEffectDamage(effect.subEffects); damage += sub[0]; spcail += sub[1]; } for (int p = 0; p < effect.sections.Length; p++) { if (effect.sections[p].attackBox.isEmpty) { continue; } var attack = AttackInfo.Get(effect.sections[p].attackBox.attackInfo); if (attack == null || attack.isIgnoreDamge) { continue; } if (attack.execution) { spcail += attack.damage; continue; } damage += attack.damage; } } } } double _d = UpSkillInfo.GetOverrideDamage(skillId, level) * (1 + modulePlayer.GetSkillDamageAddtion(skillId)); defaultDouble[0] = damage * (1 + _d); defaultDouble[1] = spcail * (1 + _d); return(defaultDouble); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { self.World.WorldActor.Trait <ScreenShaker>().AddEffect(info.Intensity, self.CenterPosition, 1); }
public void DamageStateChanged(Actor self, AttackInfo e) { overlay.ReplaceAnim(RenderSprites.NormalizeSequence(overlay, e.DamageState, overlay.CurrentSequence.Name)); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { ClearQueue(); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { ReleaseSlaves(self); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { Killed(self, e); }
protected virtual void SetAttackInfo(IDamagable damagable) { _attackInfo = new AttackInfo(_attackerInterface, damagable, DamageType, AttackColor); _attackInfo.DamageAmount = GetDamageAmount(damagable); }
public void Killed(Actor self, AttackInfo e) { self.World.WorldActor.Trait <ScreenShaker>().AddEffect(Info.Intensity, self.CenterLocation, 1); }
public void Damaged(Actor self, AttackInfo e) { power.PlayerPower.UpdateActor(self); }
void INotifyKilled.Killed(Actor self, AttackInfo e) { RemoveCellsFromPlayerShroud(self, self.Owner); }
void IRemoveInfector.RemoveInfector(Actor self, bool kill, AttackInfo e) { RemoveInfector(self, kill, e); }
public void Killed(Actor self, AttackInfo e) { var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner; Sound.PlayNotification(player, "Speech", Info.Notification, self.Owner.Country.Race); }
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) { overlay.ReplaceAnim(RenderSprites.NormalizeSequence(overlay, e.DamageState, Info.Sequence)); }
public void InflictDamage(Actor self, Actor attacker, Damage damage, bool ignoreModifiers) { // Overkill! Don't count extra hits as more kills! if (IsDead) { return; } var oldState = DamageState; // Apply any damage modifiers if (!ignoreModifiers && damage.Value > 0) { var modifiers = damageModifiers .Concat(damageModifiersPlayer) .Select(t => t.GetDamageModifier(attacker, damage)); damage = new Damage(Util.ApplyPercentageModifiers(damage.Value, modifiers), damage.DamageTypes); } hp = (hp - damage.Value).Clamp(0, MaxHP); var ai = new AttackInfo { Attacker = attacker, Damage = damage, DamageState = DamageState, PreviousDamageState = oldState, }; foreach (var nd in notifyDamage) { nd.Damaged(self, ai); } foreach (var nd in notifyDamagePlayer) { nd.Damaged(self, ai); } if (DamageState != oldState) { foreach (var nd in notifyDamageStateChanged) { nd.DamageStateChanged(self, ai); } } if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead) { foreach (var nd in attacker.TraitsImplementing <INotifyAppliedDamage>()) { nd.AppliedDamage(attacker, self, ai); } foreach (var nd in attacker.Owner.PlayerActor.TraitsImplementing <INotifyAppliedDamage>()) { nd.AppliedDamage(attacker, self, ai); } } if (hp == 0) { foreach (var nd in notifyKilled) { nd.Killed(self, ai); } foreach (var nd in notifyKilledPlayer) { nd.Killed(self, ai); } if (RemoveOnDeath) { self.Dispose(); } if (attacker == null) { Log.Write("debug", "{0} #{1} was killed.", self.Info.Name, self.ActorID); } else { Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID); } } }
public void Damaged(Actor self, AttackInfo e) { if (e.Damage > 0) /* fix to allow healing via `damage` */ remainingProneTime = defaultProneTime; }
public void Killed(Actor self, AttackInfo e) { UnReserve(); }
public void Killed(Actor self, AttackInfo e) { if (self.Owner.WinState == WinState.Lost || !self.World.Map.Contains(self.Location)) { return; } foreach (var condition in self.TraitsImplementing <IPreventsEjectOnDeath>()) { if (condition.PreventsEjectOnDeath(self)) { return; } } var r = self.World.SharedRandom.Next(1, 100); if (r <= 100 - info.SuccessRate) { return; } var cp = self.CenterPosition; var inAir = !self.IsAtGroundLevel(); if ((inAir && !info.EjectInAir) || (!inAir && !info.EjectOnGround)) { return; } var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) }); if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot)) { if (inAir) { self.World.AddFrameEndTask(w => { w.Add(pilot); pilot.QueueActivity(new Parachute(pilot, cp)); }); Sound.Play(info.ChuteSound, cp); } else { self.World.AddFrameEndTask(w => w.Add(pilot)); var pilotMobile = pilot.TraitOrDefault <Mobile>(); if (pilotMobile != null) { pilotMobile.Nudge(pilot, pilot, true); } } } else { pilot.Dispose(); } }
public virtual void ApplyHeal(AttackInfo attackInfo, bool revive) { if (attackInfo.DamageAmount <= 0) { return; } bool preHealDeadState = IsDead; if (IsDead && !revive) { return; } DamageTaken -= attackInfo.DamageAmount; if (preHealDeadState && !IsDead) { //broadcast revive EventsAggregator.Units.Broadcast<BaseUnit, HitInfo>(EUnitEvent.ReviveCame, this, new HitInfo(HealthPoints - DamageTaken - attackInfo.DamageAmount, HealthPoints - DamageTaken));//, attackInfo.IsCritical)); } else { //broadcast heal EventsAggregator.Units.Broadcast<BaseUnit, HitInfo>(EUnitEvent.HitReceived, this, new HitInfo(HealthPoints - DamageTaken - attackInfo.DamageAmount, HealthPoints - DamageTaken));//, attackInfo.IsCritical)); } }
public override void DamageStateChanged(Actor self, AttackInfo e) { base.DamageStateChanged(self, e); t.QuantizedFacings = anim.CurrentSequence.Facings; }
public AttackInfo StealGold(CreepUnit Target) { double Miss = 1; double StealAmp = 1; double CritAmp = 1; bool isCritical = false; int StealPower = Luck / 3; if (Target.Weakness == DmgType) { StealAmp += 0.35; } if (Target.Resist == DmgType) { StealAmp -= 0.35; } Random Rand = new Random(); int Crit = Rand.Next(30 + (Level * 2) + Luck); if (Crit < Luck) { isCritical = true; CritAmp += Rand.NextDouble(); if (CritAmp > 1.3) { CritAmp = 1.3; } else if (CritAmp < 1.15) { CritAmp = 1.15; } } int MissRand = Rand.Next(Luck); if (MissRand > Luck / 2) { Miss = 0; } double StealAmount = (double)StealPower * StealAmp * CritAmp * Miss; AttackInfo info = new AttackInfo(0, DmgType, isCritical, (int)StealAmount); info.X = Target.Position.X; info.Y = Target.Position.Y; return info; }
public override void UpdateAttackResults(Coordinate lastAttack, AttackResult result, bool sunkShip) { switch (atkState) { case AtkState.StabInTheDark: if (result == AttackResult.Hit) { atkState = AtkState.FindFollowUp; firstHit = new AttackInfo(lastAttack, result, sunkShip); targets = CalcAdjCoords(lastAttack).FindAll(t => Attacks[t.X, t.Y].Result == AttackResult.Unknown); } break; case AtkState.FindFollowUp: if (sunkShip) { atkState = AtkState.StabInTheDark; break; } if (result == AttackResult.Hit) { atkState = AtkState.FinishEmOff; secondHit = new AttackInfo(lastAttack, result, sunkShip); targets.Clear(); } break; case AtkState.FinishEmOff: if (result == AttackResult.Hit && sunkShip) { atkState = AtkState.StabInTheDark; firstHit = null; secondHit = null; } break; default: atkState = AtkState.StabInTheDark; break; } base.UpdateAttackResults(lastAttack, result, sunkShip); }