public bool IsActiveInCurrentActionPhase( int currentTurn, int onDuration, int restDuration, int startOffset, bool delayTillMoveStart, ActionPhaseCheckMode phaseCheckMode) { bool flag1 = false; bool flag2; if ((flag2 = IsActiveInCurrentTurn(currentTurn, onDuration, restDuration, startOffset)) && phaseCheckMode == ActionPhaseCheckMode.Any) { flag1 = true; } else if (flag2) { if (delayTillMoveStart) { bool flag3 = IsActiveInCurrentTurn(currentTurn - 1, onDuration, restDuration, startOffset); if (!IsOnStartOfIntervalCycle(currentTurn, onDuration, restDuration, startOffset) && flag3) { flag1 = true; } else if (!(flag1 = phaseCheckMode == ActionPhaseCheckMode.Movement) && phaseCheckMode == ActionPhaseCheckMode.Default) { switch (ServerClientUtils.GetCurrentActionPhase()) { case ActionBufferPhase.AbilitiesWait: case ActionBufferPhase.Movement: case ActionBufferPhase.MovementChase: case ActionBufferPhase.MovementWait: flag1 = true; break; case ActionBufferPhase.Done: if (GameFlowData.gameState == GameState.BothTeams_Resolve || GameFlowData.gameState == GameState.EndingTurn) { goto case ActionBufferPhase.AbilitiesWait; } else { break; } } } } else { flag1 = true; } } return(flag1); }
public void SerializeToStream(ref IBitStream stream) { byte bitField1 = ServerClientUtils.CreateBitfieldFromBools( m_hasDamage, m_hasHealing, m_hasTechPointGain, m_hasTechPointLoss, m_hasTechPointGainOnCaster, m_hasKnockback, m_targetInCoverWrtDamage, m_canBeReactedTo); stream.Serialize(ref bitField1); byte bitField2 = ServerClientUtils.CreateBitfieldFromBools( m_damageBoosted, m_damageReduced, m_updateCasterLastKnownPos, m_updateTargetLastKnownPos, m_updateEffectHolderLastKnownPos, m_updateOtherLastKnownPos, m_isPartOfHealOverTime, m_triggerCasterVisOnHitVisualOnly); stream.Serialize(ref bitField2); if (m_hasDamage) { short finalDamage = (short)m_finalDamage; stream.Serialize(ref finalDamage); } if (m_hasHealing) { short finalHealing = (short)m_finalHealing; stream.Serialize(ref finalHealing); } if (m_hasTechPointGain) { short finalTechPointsGain = (short)m_finalTechPointsGain; stream.Serialize(ref finalTechPointsGain); } if (m_hasTechPointLoss) { short finalTechPointsLoss = (short)m_finalTechPointsLoss; stream.Serialize(ref finalTechPointsLoss); } if (m_hasTechPointGainOnCaster) { short finalTechPointGainOnCaster = (short)m_finalTechPointGainOnCaster; stream.Serialize(ref finalTechPointGainOnCaster); } if (m_hasKnockback) { short actorIndex = (short)(m_knockbackSourceActor?.ActorIndex ?? ActorData.s_invalidActorIndex); stream.Serialize(ref actorIndex); } if (m_hasDamage && m_targetInCoverWrtDamage || m_hasKnockback) { float damageHitOriginX = m_damageHitOrigin.x; float damageHitOriginZ = m_damageHitOrigin.z; stream.Serialize(ref damageHitOriginX); stream.Serialize(ref damageHitOriginZ); } if (m_updateEffectHolderLastKnownPos) { short effectHolderActor = (short)(m_effectHolderActor?.ActorIndex ?? ActorData.s_invalidActorIndex); stream.Serialize(ref effectHolderActor); } if (m_updateOtherLastKnownPos) { byte otherActorsToUpdateVisibilityNum = (byte)(m_otherActorsToUpdateVisibility?.Count ?? 0); stream.Serialize(ref otherActorsToUpdateVisibilityNum); for (int i = 0; i < otherActorsToUpdateVisibilityNum; i++) { short actorIndex = (short)m_otherActorsToUpdateVisibility[i].ActorIndex; stream.Serialize(ref actorIndex); } } bool hasEffectsToStart = !m_effectsToStart.IsNullOrEmpty(); bool hasEffectsToRemove = !m_effectsToRemove.IsNullOrEmpty(); bool hasBarriersToAdd = !m_barriersToAdd.IsNullOrEmpty(); bool hasBarriersToRemove = !m_barriersToRemove.IsNullOrEmpty(); bool hasSequencesToEnd = !m_sequencesToEnd.IsNullOrEmpty(); bool hasReactions = !m_reactions.IsNullOrEmpty(); bool hasPowerupsToRemove = !m_powerupsToRemove.IsNullOrEmpty(); bool hasPowerupsToSteal = !m_powerupsToSteal.IsNullOrEmpty(); bool hasDirectPowerupHits = !m_directPowerupHits.IsNullOrEmpty(); bool hasGameModeEvents = !m_gameModeEvents.IsNullOrEmpty(); bool isCharacterSpecificAbility = m_isCharacterSpecificAbility; bool hasOverconIds = !m_overconIds.IsNullOrEmpty(); byte bitField3 = ServerClientUtils.CreateBitfieldFromBools( hasEffectsToStart, hasEffectsToRemove, hasBarriersToRemove, hasSequencesToEnd, hasReactions, hasPowerupsToRemove, hasPowerupsToSteal, hasDirectPowerupHits); byte bitField4 = ServerClientUtils.CreateBitfieldFromBools( hasGameModeEvents, isCharacterSpecificAbility, hasBarriersToAdd, hasOverconIds, false, false, false, false); stream.Serialize(ref bitField3); stream.Serialize(ref bitField4); if (hasEffectsToStart) { AbilityResultsUtils.SerializeEffectsToStartToStream(ref stream, m_effectsToStart); } if (hasEffectsToRemove) { AbilityResultsUtils.SerializeIntListToStream(ref stream, m_effectsToRemove); } if (hasBarriersToAdd) { AbilityResultsUtils.SerializeBarriersToStartToStream(ref stream, m_barriersToAdd); } if (hasBarriersToRemove) { AbilityResultsUtils.SerializeIntListToStream(ref stream, m_barriersToRemove); } if (hasSequencesToEnd) { AbilityResultsUtils.SerializeSequenceEndDataListToStream(ref stream, m_sequencesToEnd); } if (hasReactions) { AbilityResultsUtils.SerializeClientReactionResultsToStream(ref stream, m_reactions); } if (hasPowerupsToRemove) { AbilityResultsUtils.SerializeIntListToStream(ref stream, m_powerupsToRemove); } if (hasPowerupsToSteal) { AbilityResultsUtils.SerializePowerupsToStealToStream(ref stream, m_powerupsToSteal); } if (hasDirectPowerupHits) { AbilityResultsUtils.SerializeClientMovementResultsListToStream(ref stream, m_directPowerupHits); } if (hasGameModeEvents) { AbilityResultsUtils.SerializeClientGameModeEventListToStream(ref stream, m_gameModeEvents); } if (hasOverconIds) { AbilityResultsUtils.SerializeIntListToStream(ref stream, m_overconIds); } m_isCharacterSpecificAbility = isCharacterSpecificAbility; }
public static BoardSquarePathInfo DeSerializePath(Component context, NetworkReader reader) { var boardSquarePathInfo1 = new BoardSquarePathInfo(); var boardSquarePathInfo2 = boardSquarePathInfo1; BoardSquarePathInfo boardSquarePathInfo3 = null; float num1 = 0.0f; sbyte num2 = 0; sbyte num3 = 0; float num4 = 0.0f; float num5 = 0.0f; float num6 = 0.0f; bool out0_1 = false; bool out1_1 = false; bool flag; if (flag = reader.ReadBoolean()) { num4 = reader.ReadSingle(); num5 = reader.ReadSingle(); num6 = reader.ReadSingle(); } bool out2 = !flag; bool out3 = false; bool out4 = false; bool out5 = false; bool out0_2 = false; bool out1_2 = false; while (!out2) { byte num7 = reader.ReadByte(); byte num8 = reader.ReadByte(); sbyte num9 = reader.ReadSByte(); int num10; switch (num9) { case 0: case 3: num10 = 1; break; default: num10 = num9 == (sbyte)1 ? 1 : 0; break; } if (num10 == 0) { num2 = reader.ReadSByte(); num3 = reader.ReadSByte(); } var bitField1 = reader.ReadByte(); var bitField2 = reader.ReadByte(); var out6 = false; var out7 = false; ServerClientUtils.GetBoolsFromBitfield(bitField1, out out0_1, out out1_1, out out2, out out3, out out4, out out5, out out6, out out7); ServerClientUtils.GetBoolsFromBitfield(bitField2, out out0_2, out out1_2); var num11 = num4; var num12 = num5; if (out6) { num11 = reader.ReadSingle(); } if (out7) { num12 = reader.ReadSingle(); } var boardSquare = context.Board.method_10(num7, num8); if (boardSquare == null) { Log.Print(LogType.Error, "Failed to find square from index [" + num7 + ", " + num8 + "] during serialization of path"); } boardSquarePathInfo2.square = boardSquare; boardSquarePathInfo2.moveCost = num1; boardSquarePathInfo2.heuristicCost = 0.0f; boardSquarePathInfo2.connectionType = (BoardSquarePathInfo.ConnectionType)num9; boardSquarePathInfo2.chargeCycleType = (BoardSquarePathInfo.ChargeCycleType)num2; boardSquarePathInfo2.chargeEndType = (BoardSquarePathInfo.ChargeEndType)num3; boardSquarePathInfo2.segmentMovementSpeed = num11; boardSquarePathInfo2.segmentMovementDuration = num12; boardSquarePathInfo2.m_reverse = out0_1; boardSquarePathInfo2.m_unskippable = out1_1; boardSquarePathInfo2.m_visibleToEnemies = out3; boardSquarePathInfo2.m_updateLastKnownPos = out4; boardSquarePathInfo2.m_moverDiesHere = out5; boardSquarePathInfo2.m_moverClashesHere = out0_2; boardSquarePathInfo2.m_moverBumpedFromClash = out1_2; boardSquarePathInfo2.prev = boardSquarePathInfo3; if (boardSquarePathInfo3 != null) { boardSquarePathInfo3.next = boardSquarePathInfo2; } if (!out2) { boardSquarePathInfo3 = boardSquarePathInfo2; boardSquarePathInfo2 = new BoardSquarePathInfo(); } } boardSquarePathInfo1.moveCost = num6; boardSquarePathInfo1.CalcAndSetMoveCostToEnd(context); return(boardSquarePathInfo1); }
public static void SerializeEffectsToStartToStream(ref IBitStream stream, List <ClientEffectStartData> effectStartList) { sbyte effectStartNum = (sbyte)effectStartList.Count; stream.Serialize(ref effectStartNum); for (int i = 0; i < effectStartNum; i++) { ClientEffectStartData effectStart = effectStartList[i]; uint effectGUID = (uint)effectStart.m_effectGUID; stream.Serialize(ref effectGUID); List <ServerClientUtils.SequenceStartData> seqStartList = effectStart.m_sequenceStartDataList; sbyte seqStartNum = (sbyte)seqStartList.Count; stream.Serialize(ref seqStartNum); for (int j = 0; j < seqStartNum; j++) { seqStartList[j].SequenceStartData_SerializeToStream(ref stream); } sbyte casterActorIndex = (sbyte)(effectStart.m_caster?.ActorIndex ?? ActorData.s_invalidActorIndex); stream.Serialize(ref casterActorIndex); sbyte targetActorIndex = (sbyte)(effectStart.m_effectTarget?.ActorIndex ?? ActorData.s_invalidActorIndex); stream.Serialize(ref targetActorIndex); if (targetActorIndex != ActorData.s_invalidActorIndex) { sbyte statusNum = (sbyte)effectStart.m_statuses.Count; stream.Serialize(ref statusNum); for (int j = 0; j < statusNum; j++) { byte statusType = (byte)effectStart.m_statuses[j]; stream.Serialize(ref statusType); } } if (targetActorIndex != ActorData.s_invalidActorIndex) { sbyte statusOnTurnStartNum = (sbyte)effectStart.m_statusesOnTurnStart.Count; stream.Serialize(ref statusOnTurnStartNum); for (int j = 0; j < statusOnTurnStartNum; j++) { byte statusType = (byte)effectStart.m_statusesOnTurnStart[j]; stream.Serialize(ref statusType); } } bool hasAbsorb = effectStart.m_absorb != 0; bool hasExpectedHoT = effectStart.m_expectedHoT != 0; byte bitField = ServerClientUtils.CreateBitfieldFromBools( effectStart.m_isBuff, effectStart.m_isDebuff, effectStart.m_hasMovementDebuff, hasAbsorb, hasExpectedHoT, false, false, false); stream.Serialize(ref bitField); if (hasAbsorb) { short absorb = (short)effectStart.m_absorb; stream.Serialize(ref absorb); } if (hasExpectedHoT) { short expectedHoT = (short)effectStart.m_expectedHoT; stream.Serialize(ref expectedHoT); } } }
// was empty public override bool OnSerialize(NetworkWriter writer, bool forceAll) { uint setBits = uint.MaxValue; var initialPos = writer.Position; if (!forceAll) { setBits = syncVarDirtyBits; writer.WritePackedUInt32(setBits); } writer.Write((sbyte)m_actorIndex); if (IsBitDirty(setBits, DirtyBit.FacingDirection)) { writer.Write((short)VectorUtils.HorizontalAngle_Deg(m_facingDirAfterMovement)); } if (IsBitDirty(setBits, DirtyBit.MoveFromBoardSquare)) { writer.Write((short)(MoveFromBoardSquare?.x ?? -1)); writer.Write((short)(MoveFromBoardSquare?.y ?? -1)); } if (IsBitDirty(setBits, DirtyBit.InitialMoveStartSquare)) { writer.Write((short)(InitialMoveStartSquare?.x ?? -1)); writer.Write((short)(InitialMoveStartSquare?.y ?? -1)); } if (IsBitDirty(setBits, DirtyBit.LineData)) { writer.Write(ServerClientUtils.CreateBitfieldFromBools(m_movementLine != null, m_numNodesInSnaredLine != 0, false, false, false, false, false, false)); if (m_movementLine != null) { LineData.SerializeLine(m_movementLine, writer); } if (m_numNodesInSnaredLine != 0) { writer.Write((sbyte)m_numNodesInSnaredLine); } } if (IsBitDirty(setBits, DirtyBit.MovementCameraBound)) { writer.Write((short)MovementCameraBounds.center.x); writer.Write((short)MovementCameraBounds.center.z); writer.Write((short)MovementCameraBounds.size.x); writer.Write((short)MovementCameraBounds.size.z); } if (IsBitDirty(setBits, DirtyBit.Respawn)) { writer.Write((short)(RespawnPickedSquare?.x ?? -1)); writer.Write((short)(RespawnPickedSquare?.y ?? -1)); writer.Write(false); // TODO respawningThisTurn writer.Write((short)m_respawnAvailableSquares.Count); foreach (var square in m_respawnAvailableSquares) { writer.Write((short)square.x); writer.Write((short)square.y); } } if (IsBitDirty(setBits, DirtyBit.QueuedAbilities) || IsBitDirty(setBits, DirtyBit.AbilityRequestDataForTargeter)) { SerializeAbilityRequestData(writer); } if (IsBitDirty(setBits, DirtyBit.QueuedAbilities)) { short queuedAbilitiesBitmask = 0; for (var index = 0; index < 14; ++index) { var flag = (short)(1 << index); if (m_queuedAbilities[index]) { queuedAbilitiesBitmask |= flag; } } writer.Write(queuedAbilitiesBitmask); } if (IsBitDirty(setBits, DirtyBit.ToggledOnAbilities)) { short toggledOnAbilitiesBitmask = 0; for (var index = 0; index < 14; ++index) { var flag = (short)(1 << index); if (m_abilityToggledOn[index]) { toggledOnAbilitiesBitmask |= flag; } } writer.Write(toggledOnAbilitiesBitmask); } return(initialPos != writer.Position); }
public static List <ClientEffectStartData> DeSerializeEffectsToStartFromStream(Component context, ref IBitStream stream) { sbyte num1 = 0; stream.Serialize(ref num1); var clientEffectStartDataList = new List <ClientEffectStartData>(num1); for (var index1 = 0; index1 < (int)num1; ++index1) { uint num2 = 0; stream.Serialize(ref num2); sbyte num3 = 0; stream.Serialize(ref num3); var sequenceStartDataList = new List <ServerClientUtils.SequenceStartData>(num3); for (var index2 = 0; index2 < (int)num3; ++index2) { var sequenceStartData = ServerClientUtils.SequenceStartData.SequenceStartData_DeserializeFromStream(ref stream); sequenceStartDataList.Add(sequenceStartData); } sbyte invalidActorIndex1 = (sbyte)ActorData.s_invalidActorIndex; stream.Serialize(ref invalidActorIndex1); ActorData actorByActorIndex1 = context.GameFlowData.FindActorByActorIndex(invalidActorIndex1); sbyte invalidActorIndex2 = (sbyte)ActorData.s_invalidActorIndex; stream.Serialize(ref invalidActorIndex2); ActorData actorByActorIndex2 = context.GameFlowData.FindActorByActorIndex(invalidActorIndex2); var statuses = new List <StatusType>(); var statusesOnTurnStart = new List <StatusType>(); if (invalidActorIndex2 != ActorData.s_invalidActorIndex) { sbyte num4 = 0; stream.Serialize(ref num4); for (var index2 = 0; index2 < (int)num4; ++index2) { byte num5 = 0; stream.Serialize(ref num5); statuses.Add((StatusType)num5); } } if (invalidActorIndex2 != ActorData.s_invalidActorIndex) { sbyte num4 = 0; stream.Serialize(ref num4); for (var index2 = 0; index2 < (int)num4; ++index2) { byte num5 = 0; stream.Serialize(ref num5); statusesOnTurnStart.Add((StatusType)num5); } } bool out0 = false; bool out1 = false; bool out2 = false; bool out3 = false; bool out4 = false; byte bitField = 0; stream.Serialize(ref bitField); ServerClientUtils.GetBoolsFromBitfield(bitField, out out0, out out1, out out2, out out3, out out4); short num6 = 0; if (out3) { stream.Serialize(ref num6); } short num7 = 0; if (out4) { stream.Serialize(ref num7); } var clientEffectStartData = new ClientEffectStartData((int)num2, sequenceStartDataList, actorByActorIndex2, actorByActorIndex1, statuses, statusesOnTurnStart, num6, num7, out0, out1, out2); clientEffectStartDataList.Add(clientEffectStartData); } return(clientEffectStartDataList); }
public ClientActorHitResults(Component context, ref IBitStream stream) { byte bitField1 = 0; stream.Serialize(ref bitField1); ServerClientUtils.GetBoolsFromBitfield(bitField1, out m_hasDamage, out m_hasHealing, out m_hasTechPointGain, out m_hasTechPointLoss, out m_hasTechPointGainOnCaster, out m_hasKnockback, out m_targetInCoverWrtDamage, out m_canBeReactedTo); byte bitField2 = 0; stream.Serialize(ref bitField2); ServerClientUtils.GetBoolsFromBitfield(bitField2, out m_damageBoosted, out m_damageReduced, out m_updateCasterLastKnownPos, out m_updateTargetLastKnownPos, out m_updateEffectHolderLastKnownPos, out m_updateOtherLastKnownPos, out m_isPartOfHealOverTime, out m_triggerCasterVisOnHitVisualOnly); short num1 = 0; short num2 = 0; short num3 = 0; short num4 = 0; short num5 = 0; if (m_hasDamage) { stream.Serialize(ref num1); m_finalDamage = num1; } if (m_hasHealing) { stream.Serialize(ref num2); m_finalHealing = num2; } if (m_hasTechPointGain) { stream.Serialize(ref num3); m_finalTechPointsGain = num3; } if (m_hasTechPointLoss) { stream.Serialize(ref num4); m_finalTechPointsLoss = num4; } if (m_hasTechPointGainOnCaster) { stream.Serialize(ref num5); m_finalTechPointGainOnCaster = num5; } if (m_hasKnockback) { short invalidActorIndex = (short)ActorData.s_invalidActorIndex; stream.Serialize(ref invalidActorIndex); m_knockbackSourceActor = (int)invalidActorIndex == ActorData.s_invalidActorIndex ? null : context.GameFlowData.FindActorByActorIndex(invalidActorIndex); } if ((!m_hasDamage || !m_targetInCoverWrtDamage ? (m_hasKnockback ? 1 : 0) : 1) != 0) { float num6 = 0.0f; float num7 = 0.0f; stream.Serialize(ref num6); stream.Serialize(ref num7); m_damageHitOrigin.X = num6; m_damageHitOrigin.Y = 0.0f; m_damageHitOrigin.Z = num7; } if (m_updateEffectHolderLastKnownPos) { short invalidActorIndex = (short)ActorData.s_invalidActorIndex; stream.Serialize(ref invalidActorIndex); m_effectHolderActor = (int)invalidActorIndex == ActorData.s_invalidActorIndex ? null : context.GameFlowData.FindActorByActorIndex(invalidActorIndex); } if (m_updateOtherLastKnownPos) { byte num6 = 0; stream.Serialize(ref num6); m_otherActorsToUpdateVisibility = new List <ActorData>(num6); for (int index = 0; index < (int)num6; ++index) { short invalidActorIndex = (short)ActorData.s_invalidActorIndex; stream.Serialize(ref invalidActorIndex); if (invalidActorIndex != ActorData.s_invalidActorIndex) { ActorData actorByActorIndex = context.GameFlowData.FindActorByActorIndex(invalidActorIndex); if (actorByActorIndex != null) { m_otherActorsToUpdateVisibility.Add(actorByActorIndex); } } } } bool out0_1 = false; bool out1_1 = false; bool out2_1 = false; bool out2_2 = false; bool out3_1 = false; bool out4 = false; bool out5 = false; bool out6 = false; bool out7 = false; bool out0_2 = false; bool out1_2 = false; bool out3_2 = false; byte bitField3 = 0; byte bitField4 = 0; stream.Serialize(ref bitField3); stream.Serialize(ref bitField4); ServerClientUtils.GetBoolsFromBitfield(bitField3, out out0_1, out out1_1, out out2_2, out out3_1, out out4, out out5, out out6, out out7); ServerClientUtils.GetBoolsFromBitfield(bitField4, out out0_2, out out1_2, out out2_1, out out3_2); m_effectsToStart = !out0_1 ? new List <ClientEffectStartData>() : AbilityResultsUtils.DeSerializeEffectsToStartFromStream(context, ref stream); m_effectsToRemove = !out1_1 ? new List <int>() : AbilityResultsUtils.DeSerializeEffectsForRemovalFromStream(ref stream); m_barriersToAdd = !out2_1 ? new List <ClientBarrierStartData>() : AbilityResultsUtils.DeSerializeBarriersToStartFromStream(context, ref stream); m_barriersToRemove = !out2_2 ? new List <int>() : AbilityResultsUtils.DeSerializeBarriersForRemovalFromStream(ref stream); m_sequencesToEnd = !out3_1 ? new List <ServerClientUtils.SequenceEndData>() : AbilityResultsUtils.DeSerializeSequenceEndDataListFromStream(ref stream); m_reactions = !out4 ? new List <ClientReactionResults>() : AbilityResultsUtils.DeSerializeClientReactionResultsFromStream(context, ref stream); m_powerupsToRemove = !out5 ? new List <int>() : AbilityResultsUtils.DeSerializePowerupsToRemoveFromStream(ref stream); m_powerupsToSteal = !out6 ? new List <ClientPowerupStealData>() : AbilityResultsUtils.DeSerializePowerupsToStealFromStream(context, ref stream); m_directPowerupHits = !out7 ? new List <ClientMovementResults>() : AbilityResultsUtils.DeSerializeClientMovementResultsListFromStream(context, ref stream); m_gameModeEvents = !out0_2 ? new List <ClientGameModeEvent>() : AbilityResultsUtils.DeSerializeClientGameModeEventListFromStream(context, ref stream); m_overconIds = !out3_2 ? new List <int>() : AbilityResultsUtils.DeSerializeClientOverconListFromStream(ref stream); m_isCharacterSpecificAbility = out1_2; IsMovementHit = false; ExecutedHit = false; }