public bool CanAddDonation(LogicLong avatarId, LogicCombatItemData data, int allianceLevel) { if (!LogicLong.Equals(avatarId, this.GetSenderAvatarId())) { if (data.GetCombatItemType() == LogicCombatItemData.COMBAT_ITEM_TYPE_CHARACTER) { if (data.GetHousingSpace() + this.m_castleUsedCapacity + LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, 0) > this.m_castleTotalCapacity) { return(false); } } else { if (this.m_castleTotalSpellCapacity == 0 || data.GetHousingSpace() + this.m_castleUsedSpellCapacity + LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, 1) > this.m_castleTotalSpellCapacity) { return(false); } } return(LogicDonationHelper.CanAddDonation(this.m_donationContainerList, avatarId, data, allianceLevel)); } return(false); }
public bool CanDonateAnything(LogicLong avatarId, int allianceLevel, bool includeDarkSpell) { if (!LogicLong.Equals(avatarId, this.GetSenderAvatarId())) { if (!this.IsCastleFull()) { int totalTroopDonation = this.GetTotalDonateCount(avatarId, 0); int totalSpellDonation = this.GetTotalDonateCount(avatarId, 1); int freeSpellCapacity = this.m_castleTotalSpellCapacity - this.m_castleUsedSpellCapacity - totalSpellDonation; int maxTroopDonation = LogicDonationHelper.GetMaxUnitDonationCount(allianceLevel, 0); int maxSpellDonation = LogicDonationHelper.GetMaxUnitDonationCount(allianceLevel, 1); if (maxTroopDonation == totalTroopDonation && maxSpellDonation == totalSpellDonation) { return(false); } if (!includeDarkSpell && freeSpellCapacity < 2 && this.m_castleTotalCapacity == this.m_castleUsedSpellCapacity + LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, 0)) { return(false); } return(LogicDonationHelper.CanDonateAnything(this.m_donationContainerList, avatarId, allianceLevel)); } } return(false); }
public bool IsCastleFull() { return(LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, 0) + this.m_castleUsedCapacity >= this.m_castleTotalCapacity && LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, 1) + this.m_castleUsedSpellCapacity >= this.m_castleTotalSpellCapacity); }
public int GetTotalDonationCapacity(int unitType) { return(LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, unitType)); }
public int GetCastleUsedCapacity(int unitType) { return((unitType == 1 ? this.m_castleUsedSpellCapacity : this.m_castleUsedCapacity) + LogicDonationHelper.GetTotalDonationCapacity(this.m_donationContainerList, unitType)); }